pyinstaller is great

68 views
Skip to first unread message

Arra Avakian

unread,
Sep 4, 2023, 2:54:34 AM9/4/23
to pyins...@googlegroups.com
Dear pyinstaller team,

I have used pyinstaller to create executables on both Windows and MacOS.
I have written a complex GUI using wxPython and pyinstaller does an amazing job!
Congratulations for designing, building, and maintaining this complex tool.
(I need to separately congratulate the wxPython team as well. My app uses background threading so that the GUI user can cancel any long running activity.)

I am a programmer who retired after a 50+ year career that started in 1967!
I first learned about programming in assembly and Fortran II on an IBM 1620.

I tried using "if __debug__" in my code and found I could suppress affected code using the python option -O (optimization). I found that pyinstaller did not complain about incorrect options when I added "--python-option=-O". But it looks like the python interpreter was run without that switch. When I run my python script using the -O switch, I can see that my program is skipping over the debug dependent code.

So I am guessing there might be a deeper reason that this particular python option is not supported by pyinstaller. If it becomes available in the future, I would love to hear about it!

Thanks again,
Arra Avakian

Steve Barnes

unread,
Sep 4, 2023, 4:04:12 AM9/4/23
to pyins...@googlegroups.com

Hi Arra,

 

Just a suggestion as a work around you could modify your “if __debug__” cases to read “if __debug__ and not getattr(sys, 'frozen', False) “ this would disable the debug on your built executables for you. See https://pyinstaller.org/en/stable/runtime-information.html for more.
 
Hope that helps,
Steve Barnes

--
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/CAM_S47RFx70RrRNvNvKv47sC5zra2zeyc0nAD6-JH1Jg5F-K-Q%40mail.gmail.com.

Arra Avakian

unread,
Sep 4, 2023, 11:00:31 AM9/4/23
to PyInstaller
Yes, it helps! Thank you Steve, that is a clever work around. I am happy with it, as I can proceed past this hiccup just fine.
Curiousity prompts me to ask: is the 'frozen' sys attribute public, e.g. documented in the pyinstaller documentation?
Any other goodies in there?
Arra

Steve Barnes

unread,
Sep 4, 2023, 11:33:43 AM9/4/23
to pyins...@googlegroups.com

Hi Arra,

 

Glad you like the idea for a work around.

 

Yes it is public & documented at https://pyinstaller.org/en/stable/runtime-information.html and yes there are several other goodies in there from what I read, e.g.:

  • An explanation about what happens to __file__ when you are running from the build executable
  • How to get to bundled (non-python) files
  • The difference between sys.executable and sys.argv[0]
  • Potential issues with LD_LIBRARY_PATH when you are calling external python programs and how to fix them

 

Well worth a read. I also think that you might like reading https://pyinstaller.org/en/stable/when-things-go-wrong.html#build-time-dependency-graph amongst others.

 

All the best,

Steve

Reply all
Reply to author
Forward
0 new messages