0
I have a script, called BLRP2Excel.py, that takes a text file called BLRP.txt in the same directory as the script, and writes some of it's content to a .xlsx file called 'Computer Data.xlsx.' The idea is to use PyInstaller (Python 3.5) to turn my script into a .exe that will run on any Windows PC, where BLRP.txt is in the same directory as the .exe, and to output 'Computer Data.xlsx' to, let's say, the same directory. The script does exactly what it's supposed to when run in PyCharm.
Here are the relevant pieces of my code:
import os
import xlsxwriter
cwd = os.getcwd()
workbook = xlsxwriter.Workbook(cwd + "\\" + 'Computer Data.xlsx')
"rest of my code"
with open(cwd + "\\" + 'BLRP.txt') as my_file:
"rest of my code"
I installed PyInstaller both in my virtual environment and directly from a command prompt in the PATH folder where my project is, opened a command prompt in the same directory as BLRP2Excel.py, and ran:
pyinstaller BLRP2Excel.py
This successfully created a pycache, build, and dist folder in the same directory as my script. I tossed my BLRP.txt into the dist folder and ran the BLRP2Excel.exe, and...
nothing happened except a flash of the command prompt.
What went wrong?
Make the logic BEFORE you convert to an exe keep the command console open so you see the output and then convert that to an EXE that also does the same thing so you can troubleshoot. Once you do that, report back the results of this with an [edit] so no one needs to guess to help you out and actually you might get something more meaningful than a quick flash to actually give you some clue to figure out on your own. Just go back to the basic with this stuff and don't overthink; the one way to tell is to see the output/result to have that display and stay with the logic, then convert and try. – Pimp Juice IT – 2017-09-03T00:15:39.113
If it still flashes after that, then look over app event log and be sure you code it to log to a file or something or else see if Windows OS is blocking it, etc. What you running, Windows XP, Vista, 7, 10 or what? – Pimp Juice IT – 2017-09-03T00:16:54.720