I have some python script which is having more number of .py files, So I have generated .exe file for that, and I am trying to run using command prompt. I am unable to run .exe file in cmd prompt but when I tried to run on my friends laptop it is working fine.
I tried in cmd like below:
C:\pythonworkspace\Verification.exe -i C:\pythonworkspace\kpi_verification_2.0\config\Verification_config.xml
getting error as below:
Cannot open self C:\pythonworkspace\Verification.exe or archive
C:\pythonworkspace\Verification.pkg
Please help me where it is going wrong.
Related
I made an .exe file using pyinstaller, but when I run the file it opens a PowerShell window as well. I was wondering if there is anyway I can get it to not open so I just have the python program open.
I haven't really tried anything as I don't really know what I'm doing.
When running pyinstaller be sure to use the --windowed argument. For example:
pyinstaller –-onefile myFile.py –-windowed
if you run it from terminal, you can use this command:
start /min "" "path\file_name.exe"
I can execute code in Command prompt using python. But recently I downloaded Atom and downloaded script but when I tried to run my code there it said: "python' is not recognized as an internal or external command, operable program or batch file." Please Help! Also, I used .py and .python to save the file but it doesn't work either way. I just wrote my first line of code yesterday. Print ('Hello World"). I have windows by the way.
I have a simple code with few "print" and "input".
I used cx_freeze to convert my python code on ".exe", but obviously when I launch my exe, it's run in background without any GUI (ofc I don't have GUI).
How to open it on cmd to interact with some "input" and see "print", like I do with my IDE (pycharm) cmd ?
Do you have to run it as an .exe, or is your goal to just run the script in cmd? To execute an .exe file in cmd, you should be able to just run by entering in the filename while you're in that file's folder directory:
Change to directory where program.exe is located by using cd:
cd C:\Users\johndoe\folder\
Run the program program.exe program.exe
However to save you compiling the python script to a .exe each time, if you already have python installed in your windows and you just want to run the python script, it should work with user inputs in the script by just entering python and the python filename (e.g. pyscript.py) into the windows cmd like below:
python pyscript.py
If your python script is a class / function that accepts arguments input1 and input 2:
python pyscript.py input1 input2
I wrote a simple script in python 3.7 and I coverted it in .exe from cmd with the following line pyinstaller -w -F -i [myicon.ico] [myscript.py] . My script works if i launch it from command line (python myscript.py ), but it doesn't work when i click on "Myscript.exe" (I have a window with this message :"Failed to execute script Myscript").
I try to create the same script without the icon but result is the same.
Someone can help me?
You can refer to that post:
Windows- Pyinstaller Error "failed to execute script " When App Clicked
Actually the answer is that python doesn't compile the icon and so you need to manually transfert the icon in the folder containing the .exe.
B
I have a command line based program that I've turned into an executable using PyInstaller. I would like the program to launch a command prompt and run when clicked. Currently I can only get it to run from the command prompt. When I click it, a blank command prompt will open, remain open for a couple of seconds and then close. I'm stuck. Does anyone have any suggestions?
Have you tried the --console flag with pyinstaller?