Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__load_xxxx functions cause problem in pyinstaller or py2exe #20

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments
Closed

Comments

@GoogleCodeExporter
Copy link

I got a problem after I generate exe with pyinstaller. It shows that dpkt
use some hacking way to import module. After I view the source code of
dpkt. I found that:

# XXX - auto-load Ethernet dispatch table from ETH_TYPE_* definitions
def __load_types():
    import os
    d = dict.fromkeys([ x[:-3] for x in
os.listdir(os.path.dirname(__file__) or '.') if x.endswith('.py') ])
    g = globals()
    for k, v in g.iteritems():
        if k.startswith('ETH_TYPE_'):
            name = k[9:]
            modname = name.lower()
            if modname in d:
                mod = __import__(modname, g)
                Ethernet.set_type(v, getattr(mod, name))

This hacking code load modules dynamically, so once it is packaged as exe
or something else, that function visit a wrong path like this
"\\buildcards\\out1.pyz/*.*"

Could you fix the problem by not to use strange hacking way to load
modules? Or provide some way to customize that behavior.

Thanks.

Original issue reported on code.google.com by Borns...@gmail.com on 30 May 2009 at 10:17

@GoogleCodeExporter
Copy link
Author

An alternative solution:

http://www.py2exe.org/index.cgi/ConfigImportProblems

Otherwise, we need to build static mappings for Ethernet types, IP protocols, 
etc. 
without circular imports.

Original comment by dugsong on 26 Mar 2010 at 2:44

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Original comment by dugsong on 26 Mar 2010 at 2:45

  • Changed state: Duplicate

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

No branches or pull requests

1 participant