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

Syntax error in package raises uncaught exception #12

Open
tallforasmurf opened this issue Jul 1, 2016 · 1 comment
Open

Syntax error in package raises uncaught exception #12

tallforasmurf opened this issue Jul 1, 2016 · 1 comment

Comments

@tallforasmurf
Copy link

turns out, ast.parse() can raise a syntax error, so the try at line 50 should have a second except to catch errors other than IO error.

In the following, the package code that causes the error was not executed when the interpreter is Python 3, but ast doesn't know that. Actually turns out it isn't even in the current level of PyInstaller, so don't bother trying to reproduce. Just the general point, ast.parse() is capable of throwing a syntax error.

 python -m blackwidow.web PyInstaller
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/blackwidow/web.py", line 99, in <module>
    web = Web(project_path, exclude=args.exclude)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/blackwidow/web.py", line 27, in __init__
    Node(file, package_root=self.package_root) for file in self.files
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/blackwidow/web.py", line 27, in <listcomp>
    Node(file, package_root=self.package_root) for file in self.files
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/blackwidow/node.py", line 21, in __init__
    self.edges = imported_modules(filename, package_root=package_root)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/blackwidow/imports.py", line 52, in imported_modules
    tree = ast.parse(fd.read(), filename=filename)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/lib/pefile_py2.py", line 82
    IMAGE_ORDINAL_FLAG              = 0x80000000L
                                                ^
SyntaxError: invalid syntax
@tallforasmurf
Copy link
Author

Actually if you pip install --upgrade PyInstaller and graph it? It's a very pretty graph, although it is way big.

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

No branches or pull requests

1 participant