Apr-20-2020, 01:00 PM
Hi, I would appreciate some guidance as I am new to Python.
I have created a very simple programme ("tables.py" code included below)and compiled it using pyinstaller (using Windows 10 Powershell). That all seemed to complete successfully (The command and responses included below.)
The file "tables.exe" is created in the folder ...scripts/dist.
When I run it I get a pop up window that says "Fatal error detected", and "Failed to execute script Tables", and has a button labeled "OK", which just causes the pop up to go away.
I would appreciate any help anyone can give me as I don't have a clue what to do. Thanks,
Ian
PS C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts> .\pyinstaller --onefile --windowed tables.py 91 INFO: PyInstaller: 3.6 91 INFO: Python: 3.8.2 91 INFO: Platform: Windows-10-10.0.18362-SP0 94 INFO: wrote C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\tables.spec 96 INFO: UPX is not available. 97 INFO: Extending PYTHONPATH with paths ['C:\\Users\\Ian\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts', 'C:\\Users\\Ian\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts'] 98 INFO: checking Analysis 237 INFO: checking PYZ 274 INFO: checking PKG 368 INFO: Building because C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\build\tables\tables.exe.manifest changed 368 INFO: Building PKG (CArchive) PKG-00.pkg 4074 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 4143 INFO: Bootloader c:\users\ian\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.exe 4144 INFO: checking EXE 4160 INFO: Rebuilding EXE-00.toc because tables.exe missing 4161 INFO: Building EXE from EXE-00.toc 4162 INFO: Appending archive to EXE C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\dist\tables.exe 4179 INFO: Building EXE from EXE-00.toc completed successfully.
The code in "tables.py"
import random
print ("test your tables")
choice = input("Want to choose a table? y/n: " )
if choice == "y":
tablechoice = int ( input ("Which One? 1 to 12:"))
trials = 1
while trials < 100:
trials = trials + 1
if choice != "y":
a = random.randint(1, 12)
else:
a = tablechoice
b = random.randint(1,12)
print( "what is", a, "times", b, "?")
answer = int (input())
while 1==1:
if answer == a * b:
print ("well done")
break
else:
print ("try again")
print( "what is", a, "times", b, "?")
answer = int (input())
I have created a very simple programme ("tables.py" code included below)and compiled it using pyinstaller (using Windows 10 Powershell). That all seemed to complete successfully (The command and responses included below.)
The file "tables.exe" is created in the folder ...scripts/dist.
When I run it I get a pop up window that says "Fatal error detected", and "Failed to execute script Tables", and has a button labeled "OK", which just causes the pop up to go away.
I would appreciate any help anyone can give me as I don't have a clue what to do. Thanks,
Ian
PS C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts> .\pyinstaller --onefile --windowed tables.py 91 INFO: PyInstaller: 3.6 91 INFO: Python: 3.8.2 91 INFO: Platform: Windows-10-10.0.18362-SP0 94 INFO: wrote C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\tables.spec 96 INFO: UPX is not available. 97 INFO: Extending PYTHONPATH with paths ['C:\\Users\\Ian\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts', 'C:\\Users\\Ian\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts'] 98 INFO: checking Analysis 237 INFO: checking PYZ 274 INFO: checking PKG 368 INFO: Building because C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\build\tables\tables.exe.manifest changed 368 INFO: Building PKG (CArchive) PKG-00.pkg 4074 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 4143 INFO: Bootloader c:\users\ian\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.exe 4144 INFO: checking EXE 4160 INFO: Rebuilding EXE-00.toc because tables.exe missing 4161 INFO: Building EXE from EXE-00.toc 4162 INFO: Appending archive to EXE C:\Users\Ian\AppData\Local\Programs\Python\Python38-32\Scripts\dist\tables.exe 4179 INFO: Building EXE from EXE-00.toc completed successfully.
The code in "tables.py"
import random
print ("test your tables")
choice = input("Want to choose a table? y/n: " )
if choice == "y":
tablechoice = int ( input ("Which One? 1 to 12:"))
trials = 1
while trials < 100:
trials = trials + 1
if choice != "y":
a = random.randint(1, 12)
else:
a = tablechoice
b = random.randint(1,12)
print( "what is", a, "times", b, "?")
answer = int (input())
while 1==1:
if answer == a * b:
print ("well done")
break
else:
print ("try again")
print( "what is", a, "times", b, "?")
answer = int (input())