1. Anthony Tuininga
  2. cx_Freeze
  3. Issues
Issue #19 resolved

Dropbox include

Anonymous created an issue

Hello there,

Thanks a lot for your cool work.

I'm trying to freeze an app using the dropbox sdk (https://www.dropbox.com/developers/core/sdk). It basically installs a module called dropbox.

I can run scripts by doing import dropbox, but whenever I try to freeze the app, the module is not found anymore.

I use cx_freeze on os x and even tried to add the module in the includes of setup.py...

Any ideas?

Thanks a lot

Comments (25)

  1. Thomas Kluyver

    Try adding it to 'packages' instead of 'includes' - a module is a single file, a package is a folder with an __init__.py file, which it is in this case. See the docs for an example.

    But if your script contains import dropbox, cx_Freeze should pick it up automatically, without you needing to specify it.

  2. iditude

    Thanks a lot for your answer... I've tried to add it in the packages, but without success...

    And yes, I've tried import dropbox as well as from dropbox import * without success...

    Any ideas?


  3. iditude

    Hey there,

    Thanks a lot for your help!

    You can find the output there http://pastebin.com/7fy3Mrph

    I created a super simple script with only "import dropbox" and tried to freeze it.

    As you can see, cx_freeze isn't finding the dropbox module. But my script works fine when launched from the command : python testdropbox.py

    Thanks a lot

  4. iditude

    Oh and btw, and to make this more interesting, Dropbox hired Guido van Rossum in December... the guy created the python language!!!

    This won't help solved the issue, but I just figured I would share this...

    Cheers guys!

  5. iditude

    Thanks for your help...

    This is the pastebin of the dropbox module installation : http://pastebin.com/Z8NZVgMc

    As you can see, it drops an egg file in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

    Initially my PATH contains : /Library/Frameworks/Python.framework/Versions/2.7/bin:otherstuffnotrelatedtopython

    And PYTHONPATH is empty...

    so I added this to my PATH : PATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/:$PATH

    and PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/:$PYTHONPATH

    Still no success... This is driving me crazy...

  6. Thomas Kluyver

    Eggs do something bizarre - you might need to add the egg directory itself to PYTHONPATH:


    ($PATH isn't relevant here - that's for finding commands to run)

  7. iditude

    Arg... I really appreciate the help here...

    I've tried your suggestion without success... The egg is a file, not a folder... I've tried with PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/:$PYTHONPATH

    But no success there...

    I've also tried on a windows machine for the sake of the exercise... No luck there either...

    Any ideas?

  8. Thomas Kluyver

    Are you sure it's the same error in all cases? I've just tried freezing it myself, and it finds the module, but it still can't import it, because of a different error:

    Traceback (most recent call last):
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
        exec code in m.__dict__
      File "test_dropbox.py", line 1, in <module>
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/dropbox_python_sdk-1.5.1-py2.7.egg/dropbox/__init__.py", line 3, in <module>
        from . import client, rest, session
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/dropbox_python_sdk-1.5.1-py2.7.egg/dropbox/client.py", line 52, in <module>
        from .rest import ErrorResponse, RESTClient
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/dropbox_python_sdk-1.5.1-py2.7.egg/dropbox/rest.py", line 24, in <module>
        TRUSTED_CERT_FILE = pkg_resources.resource_filename(__name__, 'trusted-certs.crt')
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 904, in resource_filename
        self, resource_name
      File "/home/thomas/Code/virtualenvs/cxf-py2/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1372, in get_resource_filename
        "resource_filename() only supported for .egg, not .zip"
    NotImplementedError: resource_filename() only supported for .egg, not .zip

    It appears that the dropbox API library doesn't support being frozen inside a zip file. Which is a bit ironic, since I thought that was the technique they use (or used to) for their own client application.

  9. iditude

    Now I'm lost... I understand your point about the crt file... That's an easy fix...

    The thing is, I never get to this error, it just never finds the module... Is there anymore debugging I could do with cx_freeze?

  10. iditude

    Ah! The pip idea was a good one... Unfortunately, while the dropbox module is included in the cx_freeze build, the program won't run... He gets really confused (see error message here http://pastebin.com/PpXdfHCT ... For some reason he's looking at files for a linux box not os x like /lib/python2.7/config/Makefile)...

    I've also entirely removed python and all it's folders in /System and /Library and reinstalled everything, still no luck... Thanks so much for your help (if someone still has ideas...)

  11. Thomas Kluyver

    Maybe that's just the last location in the list of places it tries? I've no idea why it needs to find a Makefile, though. It also looks wrong that pkg_resources has been found in build/bdist.linux-i686/egg/pkg_resources.py.

  12. frukoprof
    Traceback(most recent call last):
    File "C:\Python32\lib\site-packages\cx_Freeze\intscripts\Console3.py", line 27 
    in <module>
    File "myProgramName.py", line 3, in <module>
    File "C:\Python32\lib\site-packages\dropbox_python_sdk-1.5.1-py3.2.egg\dropbox
    \__init__.py", line 3, in <module>
    from . import client,rest,session
    File "C:\Python32\lib\site-packages\dropbox_python_sdk-1.5.1-py3.2.egg\dropbox
    \client.py", line 49,in <module>
    from .rest import ErrorResponse,RESTClient
    File "C:\Python32\lib\site-packages\dropbox_python_sdk-1.5.1-py3.2.egg\dropbox
    \rest.py", line 28, in <module>
    TRUSTED_CERF_FILE = pkg_resources.resource_filename(__name__,"trusted-
    File "C:\Python32\lib\site-packages\distribute-0.6.35-py3.2.egg
    \pkg_resources.py", line 1388, in get_resource_filename
    "resource_filename() only supported for .egg, not .zip"
    NotImplementedError: resource_filename() only supported for .egg, not .zip

    I installed py3.2 because i read its a only py33 issue in some websites. I take care of this error for 4 days, i researched this error.

    I have 2 question:

    If/when you get to that error, you'll need to copy in trusted_certs.crt using the include-files option, and modify the dropbox code to use the new location. You said. How can i use include-files option? we can't use seperator in variable names. I tried manually but unsuccessful. modify the dropbox code to use the new location Modify but how? library.zip is not a directory. Can you help me?

  13. Thomas Kluyver

    If you're using it in a setup.py script, the name will be include_files, I guess. See the example in the docs for the options structure.

    You would have to modify the dropbox package before freezing, so that it froze with your modified version. You'd have to do something like this:

    if hasattr(sys, 'frozen'):
       # Frozen application
       filename = os.path.join(os.path.dirname(sys.executable), 'trusted-certs.crt')
      # Fall back to the code that's already there.
  14. Log in to comment