FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Compiled project crashes when frozen with cx_freeze · Issue #66 · pythonnet/pythonnet · GitHub

Repository navigation

Compiled project crashes when frozen with cx_freeze #66

Closed

Description

Machine specs:
Windows 7 64bit
Python 2.7 32bit
.Net Framework 4.5.2

I download the repo for pythonnet and built the project using ReleaseWin on platform x86 using visual studio 2012.
pythonnet works fine but once i freeze the app using cx_freeze the app crashes.

It worked well with the source forge version but fails on windows 8 and 8.1.

After googling around i found that building the repo using x86 solves the problem.

Please anyone knows a fix ?

Activity

  1. jfbramboll commented on Mar 20, 2015

    I'm getting the exact same error as here: http://stackoverflow.com/questions/26110026/pyinstaller-and-pythonnet-clr

    I've tried cx_freeze, py2exe and pyinstaller. I'm using Python 2.7 64bit, Windows 7 64bit. and I have a bunch of .Net frameworks installed, including 4 and 4.5.

    Is it at all possible to create an exe that using python.net?

  2. den-run-ai commented on Jan 30, 2016

    Contributor

    @jfbramboll @kelvinomolumo PyInstaller should provide a hook to include pythonnet:

    pyinstaller/pyinstaller#637

    it is reportedly working for people here:
    https://groups.google.com/forum/#!topic/pyinstaller/juS48yx3XyE

    I am not sure about cx_freeze

  3. den-run-ai commented on Aug 29, 2016

    Contributor

    pyinstaller has been updated to include proper clr (pythonnet) hook:

    pyinstaller/pyinstaller#1801

  4. konstantin-popov commented on Mar 6, 2017

    In order to stop crashing with cx_freeze you need to manually add Python.Runtime.dll file from pythonnet package to your binary directory.

  5. den-run-ai commented on Mar 6, 2017

    Contributor

    @konstantin-popov does cx_freeze allow configuring hooks for various packages so that this works by default?

  6. konstantin-popov commented on Mar 6, 2017

  7. den-run-ai commented on Mar 6, 2017

    Contributor

    @konstantin-popov feel free to submit a pull request to cx_freeze to implement this hook based on pyinstaller implementation. We cannot do anything about this in pythonnet without breaking a lot of code.

    marcelotduarte/cx_Freeze#249

  8. konstantin-popov commented on Mar 6, 2017

    We cannot do anything about this in pythonnet without breaking a lot of code.

    Sure. My reply was not a call to action, only a recipe how to deal with this specific problem - actually not with patching cx_freeze, but with adding a file to build using configuration options (option 'include_files').

    The ticket you mentioned is actually about a different problem - failing to import custom .NET libraries in frozen app.

  9. den-run-ai commented on Mar 6, 2017

    Contributor

    @konstantin-popov you need to update sys.path in order to custom load your .NET assemblies. See fairly complicated example for pyinstaller here:

    #325

  10. konstantin-popov commented on Mar 7, 2017

    I do update sys.path and clr.AddReference('customlib') throws no exceptions - the problem appears later in code when importing the assembly.
    I guess pythonnet hooks into python import system to load .NET assemblies, but after freezing the app with cx_freeze in doesn't work for some reason.

  11. vmuriart commented on Mar 7, 2017

    Contributor

    Is there a traceback available?

  12. den-run-ai commented on Mar 7, 2017

    Contributor

    @konstantin-popov minimum reproducible example would be handy. Also make sure that your library does not reference other custom assemblies, maybe even during runtime.

  13. konstantin-popov commented on Mar 10, 2017

    Also make sure that your library does not reference other custom assemblies, maybe even during runtime.

    That was exactly the thing. The library was external so I didn't guess it referenced somethine else. Thanks @denfromufa!

    P.S. PR with a hook for pythonnet in cx_freeze

  14. anthony-tuininga commented on Mar 11, 2017

    Pull request merged.

  15. den-run-ai commented on Mar 11, 2017

    Contributor

    @jfbramboll @kelvinomolumo can you please verify that the pythonnet hook is now working in cx_freeze? @anthony-tuininga @konstantin-popov thanks for implementing this!

    Anyway if any issues come up we can reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL