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
Pyinstaller crashes when packaging application that uses pyodbc #2492
Comments
Hm, this should not happen: It looks like PyInstaller tries to analyse pyodbc's byte-code, which does not exist since this module is a C-extension. PyInstaller tries to detect the modules imported by C-extensions, and maybe pyodbc (indirectly) imports ctypes - which would explain why pyodbc is recogniced as "imports ctypes". But in I can't reproduce this here since I don't have Windows. Can you please
|
Here is some output of the debugger for the pyodbc module...
532 node = self.findNode('ctypes')
533 if node:
534 referers = self.getReferers(node)
535 B for r in referers:
536 r_ident = r.identifier
537 -> r_type = type(node).__name__
538 # Ensure that modulegraph objects has attribute
'code'.
539 if r_type in PURE_PYTHON_MODULE_TYPES:
540 if r_ident == 'ctypes' or
r_ident.startswith('ctypes.'):
541 # Skip modules of 'ctypes' package.
542 continue
(Pdb) n
c:\python34\lib\site-packages\pyinstaller-3.3.dev0+8b491de-py3.4.egg\pyinstaller\depend\analysis.py(539)get_co_using_ctypes()
-> if r_type in PURE_PYTHON_MODULE_TYPES:
(Pdb) print(r_type)
Package
(Pdb) print(r_ident)
pyodbc
(Pdb) print(node)
Package('ctypes', 'C:\\Python34\\lib\\ctypes\\__init__.py',
['C:\\Python34\\lib\\ctypes'])
(Pdb) print(r)
Extension('pyodbc', 'C:\\Python34\\lib\\site-packages\\pyodbc.pyd')
(Pdb)
…On Thu, Mar 9, 2017 at 10:49 AM, Hartmut Goebel ***@***.***> wrote:
Hm, this should not happen: It looks like PyInstaller tries to analyse
pyodbc's byte-code, which does not exist since this module is a
C-extension. PyInstaller tries to detect the modules imported by
C-extensions, and maybe pyodbc (indirectly) imports ctypes - which would
explain why pyodbc is recogniced as "imports ctypes". But in
PyiModuleGraph.get_co_using_ctypes() the extensions ought to be filtered
out.
I can't reproduce this here since I don't have Windows.
Can you please
- start PyInstaller under debugger control python -m pdb
./pyinstaller.py ...
- set a breakpoint break PyInstaller/depend/analysis.py:535
- start running with c (continue)
- when the breakpoint is reached, print referers and try debug, why
pyodbc is not filtered out, esp. what it pyobdc's type(node).__name__?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2492 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO-wUXJoCAqOBkeCH7NsQqkxUOYd6Grhks5rkC22gaJpZM4MXnRe>
.
--
Nuri Eady
Rockwell Collins
319-263-0421
Nuri.Eady@rockwellcollins.com
|
… to ctypes. Includes test-case. The fix (see two commits back, 17a49a9) raised another issue: ctype imports from the main script were ignored, since "Script" is not part of "PURE_PYTHON_MODULE_TYPES".
In CI tests are run with --debug, which will make the graph and xref files to be written- For this the filenames need to be defined :-(
… to ctypes. Includes test-case. The fix (see two commits back, 17a49a9) raised another issue: ctype imports from the main script were ignored, since "Script" is not part of "PURE_PYTHON_MODULE_TYPES".
In CI tests are run with --debug, which will make the graph and xref files to be written- For this the filenames need to be defined :-(
Pyinstaller crashes when packaging an application that imports pyodbc. I created a very simple "Hello World" application that simply imports pyodbc...
import pyodbc
print("hello")
Removing the pyodbc import statement allows pyinstaller to run without issue. Below is the log from the crash...
The text was updated successfully, but these errors were encountered: