pyinstaller with module spanning multiple paths

92 views
Skip to first unread message

Thor Andreas Tangen

unread,
May 25, 2015, 5:52:35 AM5/25/15
to pyins...@googlegroups.com
I have a module/package structure which is somewhat special, I have multiple user made libraries which I keep in separate repositories, and they have fairly generic names like db, io, utils and so on. To avoid conflict with other packages I have a top level package named acme, i.e. my packages are acme.io, acme.db, acme.utils and so on. To make this work, the \__init__.py in all the acme folders has the following lines
 
from pkgutil import extend_path
__path__
= extend_path(__path__, __name__)

This works well when running the software which uses these packages from python.

But then I try making an EXE using pyinstaller. pyinstaller finds only one of these packages. I tried to set the pathex to the folder where each of these libraries reside:

a = Analysis(['.\\src\\myPgogram.py'],
             pathex
=['C:\\Data\\python\\myProgram', 'C:\\Data\python\\dbrepo', 'C:\\Data\\python\\utilsrepo', 'C:\\Data\\python\\iorepo'],
             hiddenimports
=['acme', 'acme.io', 'acme.utils', 'acme.db'],
             hookspath
=None,
             runtime_hooks
=None)


In the folders dbrepo, iorepo and utilsrepo there is a folder named acme, with the above mentioned \__init__.py file and the the corresponding package, i.e. db, utils and io, with a \__init__.py file within them again.

But pyinstaller only finds the acme and acme.db package. Or it finds only the package which path is listed first in the pathex variable.

Any hints to how I can make this work? Tried making hooks, but they are never called...

Thanks

Hartmut Goebel

unread,
May 25, 2015, 1:39:29 PM5/25/15
to pyins...@googlegroups.com
Am 22.05.2015 um 11:03 schrieb Thor Andreas Tangen:
Any hints to how I can make this work? Tried making hooks, but they are never called...

Namespace packages are not fully supported. You may try the current development version, which includes limited namespace support. Otherwise you adding some symlinks to the "acme" directory should work, too.

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/ausgerechnet-csc-will-websites-sicherheit-testen-..
Kolumne: http://www.cissp-gefluester.de/2010-09-mut-zur-beschraenkung

Thor Andreas Tangen

unread,
Jun 1, 2015, 7:45:06 AM6/1/15
to pyins...@googlegroups.com
Hi

Ok, thank you for the answer. But the documentation indicates that it does so under the section called "Extending a packages __path__". Maybe I misunderstood this section. Could you come up with an example of extending a pacakge path?

Thor Andreas

Thor Andreas Tangen

unread,
Jun 1, 2015, 7:48:18 AM6/1/15
to pyins...@googlegroups.com
Hi

Could you close the issue I created on this matter?

Thanks,

Hartmut Goebel

unread,
Jun 1, 2015, 9:52:55 AM6/1/15
to pyins...@googlegroups.com
Am 01.06.2015 um 13:45 schrieb Thor Andreas Tangen:
Ok, thank you for the answer. But the documentation indicates that it does so under the section called "Extending a packages __path__". Maybe I misunderstood this section. Could you come up with an example of extending a pacakge path?

This section basically describes what namepace packages are doing (depending on the mechanism they use). This section is for those having namespace packages go get them working with PyInstaller. But I can not nee any namespace package in your setup.


--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Thor Andreas Tangen

unread,
Jun 1, 2015, 10:01:14 AM6/1/15
to pyins...@googlegroups.com
Hi

"Normally, the __path__ of an imported module has only one entry, the directory in which the __init__.py was found. But __init__.py is free to extend its __path__ to include other directories."

My acme package has subpackages (direct) in different directories. In relation to pkgutils, extending the path is something used to handle such a case. See https://github.com/pyinstaller/pyinstaller/issues/1283 for an example of the structure of the packages on disk. There you can see that the acme package has (direct) subpackes in C:\python\io\acme, C:\python\db\acmeC:\python\utils\acme. I tought acme in this case was what was called a namespace package. In the acme folders there is nothing but a __init__.py file.

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/FcZa03oPzhY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages