Issue #17 invalid
Daniel Bengtsson
created an issue

I was trying use 'pyinstaller' on a script that makes use of wheezy.templates to generate a .exe file.

However it could handle all modules except wheezy.templates. The only way in which that differed was that the directory layout used the subfolder (in this case 'template'). Apparently pyinstaller could not recognize this as a module due to this.

Adding an __init__.py file will let pyinstaller recognize this as a package directory.

So shouldn't it have that file there ?

Hm, but I just had a look at the repo where this file is present. So now I am confused, I installed using pip, so could it be that the file goes missing in that step ?

Comments (11)

  1. Andriy Kornatskyy repo owner

    Probably this somehow related to namespace packages... that is the only thing that is 'unusual'.

    I checked my virtual environment... __init__.py files are where they should be. I do not think this somehow related to pip/easy_install.

    How about reinstall it?

  2. Daniel Bengtsson reporter

    Interesting and confusing, I tried to remove and reinstall but the file is still missing.

    I also tried pip install -v wheezy.template and the output contains:

    copying wheezy/template/__init__.py -> C:\Python27\Lib\site-packages\wheezy\template
    byte-compiling C:\Python27\Lib\site-packages\wheezy\template\__init__.py to __init__.pyc
    

    I can also see a directory site-packages\wheezy.template-0.1.167-py2.7.egg-info with a file installed-files.txt which also lists this file.

    Yet when installation is done the file is not present in the destination dir.

    This is on Windows 7 with python 2.7.10.

    However I found something interesting here, according to that it seem that the file cannot be empty, it should contain a line:

    __import__('pkg_resources').declare_namespace(__name__)
    

    although someone here say that this is better:

    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)
    

    although I don't know why it works for you but not for me.

  3. Daniel Bengtsson reporter

    I tried this now on a linux box:

    $> sudo pip install wheezy.template
    
    $> ls -l /usr/lib/python3.3/site-packages/wheezy
    totalt 4
    drwxr-xr-x 4 root root 4096 17 sep 18.00 template
    $> 
    

    Tried the same on that machine with python 2 also with the same result.

  4. Daniel Bengtsson reporter

    I tried with easy_install, and then I can see the file is there in the egg directory. However I then got this if I tried to use it:

    IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/wheezy.template-0.1.167-py2.7.egg/EGG-INFO/namespace_packages.txt'
    

    I am only using wheezy.template.

    (And yes using virtualenv or not did not seem to affect)

  5. Daniel Bengtsson reporter

    Checked a bit more and apparently it was a known issue in pyinstaller. It's already fixed in the developer releases (and indeed it seemed to work there) - although it had other issues.

    Anway there seem to be nothing wrong in wheezy.template. Sorry for taking your time and thanks for providing it.

  6. Log in to comment