I am using PyInstaller to build a python file that works completely fine when interpreted by Python.
When running it as an exe-file made with PyInstaller, it throws WinError 6 when built with the --noconsole argument. It works fine though when it is made with console enabled.
The only information I get is WinError 6: The handle is invalid.
I can not get further information on the error, as it does not occur when run as source code or in a PyInstaller mode with console enabled.
I have read though, that subprocess.getoutput is the cause of this. I only pass it my command as a string and do not give it data for its encoding or error arguments, as I am yet to learn how to use them.
Is there anything I could do to make my program work?
Related
I'm working on a VirtualBox Machine running Ubuntu 20.04 as the software. I'm using the virtual machine to create executable scripts using pyinstaller that will work across several platform types.
What Happens
Using the terminal, I run python3 -m PyInstaller --onefile "filename.py", which works as it should and creates a single file of the program. However, the name of the program is just that, the name. There is no file type associated with it and the end is just blank. For example, if the program name is program v.1.0.py, the executable's name is program v.1.0. Once I click on it, it will not run and nothing will show up. The log file I have set up shows the error CRITICAL: Program experienced unexpected error. Program terminated with EOF when reading a line. From my research, I understand this can happen when there is an input clause that is not fulfilled, which makes sense as the first line of the code begins with an input line.
What Should Happen
The executable should pop up a terminal dialogue as it does on my Debian and Windows devices, but instead, I get nothing, not even an indication of something going wrong. If anyone has experience with something similar and an idea of how to fix it, I would appreciate the help.
I am trying to run a python script using VS code and I'm getting a weird error when I'm using the WSL bash. I included an image of the error
What is bash: syntax error near unexpected token '(' referring to?
It's not working because the Python extension thinks you're running under Windows which suggests you manually set your terminal to WSL. Please make sure to use the Remote - WSL extension as that will make VS Code and all extensions treat your environment as WSL/Linux instead of Windows.
That usually means there is a parenthesis that needs to be escaped.
Try escaping it like Program Files \(x86\)
I'm trying to make my python program run on other systems without python installation. I made use of tkinter to create a gui, after creating an exe file with pyinstaller it throws a fatal error "Failed to run script". I've checked my code several times and it works well. I don't know what's wrong.
Create the file using the -F switch only and run from your command line. You should see the actual error.
build: pyinstaller -F your_script.py
run: C:\some_dir\dist\your_script.exe
I have run into issues like this when a module is in a directory that is lowercase and pyinstaller is looking for an uppercase first character. e.g. C:\Python27\Lib\site-packages\queue vs C:\Python27\Lib\site-packages\Queue
The error is very generic and at this point, it may not be possible to find the actual error what preventing the execution.
In order to get actual error please exclude '--windowed' or '--noconsole' parameters during installation and then execute with 'pyinstaller -filename.py --onefile'. Then on execution it will show exact error instead of 'Fatal error! Failed to execute script'. Then you can proceed accordingly.
Using Pyhton 2.7 and Ubuntu 15.10
I faced an annoying issue when using raw_input in a python console of some IDES like ninja-ide or genay (console plugin). They cast a "EOFError: EOF when reading a line" and don't allow to write.
Meanwhile developing a *.py file, the execution is correct and don't fail. Python, as executing from terminal, doesn't fail as well as console using IDLE.
Any solution? Thanks. I couldn't find exactly this issue neither in StackOverflow nor Internet.
EDIT: The code I wrote in my Python file was just this:
print "foo"
I'm using Windows XP Home Premium on this tiny little HP Mini 1000, and I want to run Python files, since we're learning it in school. I am aware of this topic, so I tried to run Python files using a batch file (python.bat), and I'm getting an error that says, "Can't find 'main' module in ''" whenever I run the batch file. I followed the instructions given here. All I did was change "Python26" to "Python33" because of the difference in versions.
Any idea what's wrong here? I really want to run Python files from Notepad++, so I don't want any alternative ways to run them.
This sounds like you don't have PYTHONPATH set up correctly. I suggest you review the documentation here:
http://docs.python.org/2/using/windows.html
Instead of calling Python, call cmd.exe and then use the set command to inspect which variables are set and how they are set. Run the exit command to leave the command shell. When you think you have the variables set up correctly, try again to run Python.
Good luck and have fun!
I use the command line interpreter or IDLE mostly (Win 8.1 now, but I've done so since Win XP SP2), but NPP is my main text editor, so I was curious about this issue.
When I was reproducing this, I was able to generate several errors, but the only one I got that was an exact match was when I failed to configure the Run option correctly.
You need to make sure to follow this step exactly in the instructions you were following. When you navigate to Run -> Run in Notepad++, you have to enter this exactly:
C:\Python33\python.bat "$(FULL_CURRENT_PATH)"
I am pretty sure you left out the "$(FULL_CURRENT_PATH)", or otherwise didn't add it correctly, as failing to do so causes exactly the same error on my end. Failing to include this means that when you run the batch script, you get the wrong input to the Python interpreter, causing the error.