EXE crashes on run, nothing displayed

91 views
Skip to first unread message

Liam Plybon`

unread,
Oct 20, 2020, 2:00:17 PM10/20/20
to PyInstaller
Hello,

Here is a description of the problem. I have a file named test.py containing just print('Hello World'). I use command line to try and make an EXE with it, typing pyinstaller test.py --log-level DEBUG. When I double click the resulting EXE I see for a brief moment a flash on the task bar, but that is all. No printed line!

I get the strong feeling that Pyinstaller is not getting all of the files it needs to do the job, but is not giving me an obvious error. I looked at the warn-test file (copy pasted at the bottom of the email) and there are a lot of things I recognize, like terminos and subprocess; things that should be standard with Python to my knowledge. What do I do to fix this? 

Thanks,
Liam 

++++++++++++++++++++++++++++++++++++++++++++++++++

This file lists modules PyInstaller was not able to find. This does not
necessarily mean this module is required for running you program. Python and
Python 3rd-party packages include a lot of conditional or optional modules. For
example the module 'ntpath' only exists on Windows, whereas the module
'posixpath' only exists on Posix systems.

Types if import:
* top-level: imported at the top-level - look at these first
* conditional: imported within an if-statement
* delayed: imported from within a function
* optional: imported within a try-except-statement

IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
           yourself tracking down the missing module. Thanks!

missing module named _posixsubprocess - imported by subprocess (conditional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), http.server (delayed, optional), webbrowser (delayed), netrc (delayed, conditional), getpass (delayed)
missing module named posix - imported by os (conditional, optional)
missing module named resource - imported by posix (top-level)
missing module named grp - imported by shutil (optional), tarfile (optional)
missing module named termios - imported by tty (top-level), getpass (optional)
missing module named vms_lib - imported by platform (delayed, conditional, optional)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named java - imported by platform (delayed)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named _winreg - imported by platform (delayed, optional)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, optional)
missing module named org - imported by pickle (optional)

bwoodsend

unread,
Oct 20, 2020, 4:02:40 PM10/20/20
to PyInstaller

Run your program from the terminal (using ./dist/test/test) instead of double-clicking it. It’ll still crash but you’ll at least get an error message you can work with. (Also I’ve never yet solved an issue using the warnings file or for anything out of --log-level DEBUG.)

Subramanian Ramajayam

unread,
Oct 21, 2020, 3:49:20 AM10/21/20
to pyins...@googlegroups.com
Hello, I had similar problem. I added this at the end of the python script:input("Press Enter to exit") 
This solved the problem of exe crashing. Try it. Good luck! 
Ramajayam

On Wed, 21 Oct, 2020, 1:32 AM bwoodsend, <bwoo...@gmail.com> wrote:

Run your program from the terminal (using ./dist/test/test) instead of double-clicking it. It’ll still crash but you’ll at least get an error message you can work with. (Also I’ve never yet solved an issue using the warnings file or for anything out of --log-level DEBUG.)

--
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/e85d5920-f703-488b-ad44-19e4df34fa89n%40googlegroups.com.

Liam Plybon

unread,
Oct 21, 2020, 3:49:31 AM10/21/20
to pyins...@googlegroups.com

Thanks, bwoodsend! I just gave that a shot, and it returned the following.

 

Error loading Python DLL 'C:\Users\liam\AppData\Local\Programs\Python\Python37\build\test\python37.dll'.

LoadLibrary: The specified module could not be found.

 

Looks like it can’t find python37.dll. Right now, that file is in \Python37, but I guess it didn’t get copied to the daughter directory?

 

If I read this correctly, all I have to do is copy the correct files into the test\ directory? I feel like there is a more elegant solution, though. For larger scripts with more dependencies that would be difficult.

 

Liam

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/kzPCbz3douE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.

Liam Plybon

unread,
Oct 21, 2020, 11:46:02 AM10/21/20
to pyins...@googlegroups.com

I gave that a shot, but no dice. Still does not work.

 

Liam

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/kzPCbz3douE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CAKa7spPxmJR-vehAp_Wxayza3BVuwoN4Hnt_T6zx2%3D0%2B3Tt0nA%40mail.gmail.com.

bwoodsend

unread,
Oct 23, 2020, 3:40:02 AM10/23/20
to PyInstaller
@Liam - In theory just copying that dll should work. But you shouldn't be in that scenario - are you using that rather strange distribution of Python from the Windows store? If not then which are you using?

@Ramajayam - That's not a crash then if putting `input` at the end changes anything. It's normal for the window to close once the program has finished. If you usually run Python from a Python editor then you're probably not used to seeing this.

Liam Plybon

unread,
Oct 23, 2020, 3:40:09 AM10/23/20
to pyins...@googlegroups.com

Update:

 

I tried it at home today on an older computer, to sanity check myself. I ended up getting the same error with python.dll. Then I realized it was a python 3.5 system, and that maybe that would have something to do with it. When I got back to work today, I installed python 3.9.0. Then, I used pip install pyinstaller in my windows\system32 directory rather than the python directory itself; not sure if that would make a difference. I made a test.py to print(‘hello world’) and ran pyinstaller. No errors this time, and when I went to \dist and ran the exe from command line, it printed hello world with no error! My guess is that either there is some incompatibility problem with old versions of python/windows10/updated pyinstaller, or making the installation in the different directory somehow did something. Ultimately I don’t understand the problem or solution.

 

I ended up running into a number of other issues, like matplotlib needing to be v3.2.2, having to delete the dist and build folders, needing to run cmd as administrator, matplotlib being unable to use .show() without a gui, numpy needing visual studio installed, and a bunch of other things. Thankfully I was able to figure them out!

 

Thanks for the help!

Reply all
Reply to author
Forward
0 new messages