PyInstaller Fails for win32com Recursion max depth exceeded

121 views
Skip to first unread message

Sreyan Chakravarty

unread,
Jan 7, 2020, 12:15:31 PM1/7/20
to pyins...@googlegroups.com
I am trying to run pyinstaller on the following file. This fails when I hit a module named win32com.


from impala.dbapi import connect
from impala_creds import *
import base64
def main():
    conn = connect(host='impala.company.com', port=21050,
    auth_mechanism='GSSAPI', database='default',
    user=base64.b64decode(username), password=base64.b64decode(password))

   cursor = conn.cursor()

   cursor.close()
   conn.close()
if name == 'main': 
   main()


I am getting a max recursion depth exceeded.

The following is an excerpt of the stack trace:

  File "C:\Users\sreyan32\AppData\Roaming\Python\Python36\site-packages\pkg_resources\__init__.py", line 1331, in safe_version
    return str(packaging.version.Version(version))
  File "C:\Users\sreyan32\AppData\Roaming\Python\Python36\site-packages\pkg_resources\_vendor\packaging\version.py", line 230, in __init__
    self._version.local,
  File "C:\Users\sreyan32\AppData\Roaming\Python\Python36\site-packages\pkg_resources\_vendor\packaging\version.py", line 353, in _cmpkey
    reversed(release),
  File "C:\Users\sreyan32\AppData\Roaming\Python\Python36\site-packages\pkg_resources\_vendor\packaging\version.py", line 352, in <lambda>
    lambda x: x == 0,
RecursionError: maximum recursion depth exceeded in comparison
I have also attached the stack trace that I could gather as reference. This is a problem with a module name win32com.

What exactly can I do to solve this problem ???


--
Regards,
Sreyan
tmp_log.txt

Sreyan Chakravarty

unread,
Jan 7, 2020, 12:15:41 PM1/7/20
to PyInstaller
tmp_log.txt

Israel Brewster

unread,
Jan 7, 2020, 12:35:59 PM1/7/20
to pyins...@googlegroups.com
I ran into the same issue (at least the same error), though I believe it was with a different library. The solution was to add the following two lines toward the top of the .spec file I was feeding to pyinstaller (one is created whenever you run it, so you can simply use that one):

import sys
sys.setrecursionlimit(5000)

So basically increase the maximum allowed recursion depth so it works. 
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/c37c0e19-c6f0-4ffb-87c6-35de0c0fc510%40googlegroups.com.
<tmp_log.txt>

Sreyan Chakravarty

unread,
Jan 8, 2020, 5:21:15 AM1/8/20
to pyins...@googlegroups.com
My spec file keeps getting reset when I do this.

What I am doing wrong in the following command ?

pyinstaller --onefile test.py test.spec

How do I stop pyinstaller from overwriting my spec file ?



--
Regards,
Sreyan

Sreyan Chakravarty

unread,
Jan 8, 2020, 5:21:24 AM1/8/20
to pyins...@googlegroups.com
Apologies.

Fixed that error.

I just used the spec file like 
pyinstaller --onefile test.spec
--
Regards,
Sreyan

Sreyan Chakravarty

unread,
Jan 8, 2020, 5:21:35 AM1/8/20
to PyInstaller
Yup solved that error with :

pyinstaller --onefile test.py test.spec

Chris Barker - NOAA Federal

unread,
Jan 28, 2020, 5:06:45 AM1/28/20
to PyInstaller


On Tuesday, January 7, 2020 at 9:35:59 AM UTC-8, Israel Brewster wrote:
I ran into the same issue (at least the same error), though I believe it was with a different library. The solution was to add the following two lines toward the top of the .spec file I was feeding to pyinstaller (one is created whenever you run it, so you can simply use that one):

import sys
sys.setrecursionlimit(5000)

So basically increase the maximum allowed recursion depth so it works. 

"M amazed that works -- I hve never seen the recursion depth exceeded when there wasn't an error -- usually an infinite loop (or a bad choice of recursive algorithm).

And for me -- 5000 does not do it.

I think there's a circular import or something in there. IN my case, I haven't foudn it, but I haven't looked too hard, either.




 
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
To unsubscribe from this group and stop receiving emails from it, send an email to pyins...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages