Executable file

399 views
Skip to first unread message

melissa makonga

unread,
Nov 9, 2020, 3:06:14 AM11/9/20
to PyInstaller
Hello,
I have been trying to convert my python scripts into executable files. I am able to convert it without error but when I try to open the .exe file, I get the error "Failed to execute script". I try to run the file in the command line so I can see why it is not working but it doesn't show me anything. Also, my other executable file doesn't even launch the app. I use matplolib in both of my scripts. I am completely lost as I don't even know where to start since I don't know what is causing the problem. If someone could please help me.
Thank you

Nurul Carvalho

unread,
Nov 9, 2020, 9:00:36 AM11/9/20
to pyins...@googlegroups.com
hello Melissa.
I guess that u need to execute your script.exe by prompt to see error log or recompile it with an shell-window to get log-error..
or if u have used some extra file into ur code u will need to put ur script.exein the same folder than ur script.py and retry to run it..

--
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/464c38e1-b2ae-4112-966b-c0b3b513e826n%40googlegroups.com.

melissa makonga

unread,
Nov 9, 2020, 10:52:38 AM11/9/20
to pyins...@googlegroups.com
Hello, Nurul
That is also one of my issues, when run it using the command prompt, I don't see any error log, I don't know why

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/HYmG_zasD6o/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/CADcH5ncNXujLdkaf5zC_SX0MFdVYJ8uTVhEHhNQeP-jXueqfxA%40mail.gmail.com.

Brenainn Woodsend

unread,
Nov 9, 2020, 11:42:15 AM11/9/20
to pyins...@googlegroups.com
It sounds like you are using the `--windowed` option? If you are then don't. It means no output meaning you can never see any errors. Or possibly you are using Conda?

Nurul Carvalho

unread,
Nov 9, 2020, 12:22:47 PM11/9/20
to pyins...@googlegroups.com
hmm... that sounds weird Melissa!
when we run any program by prompt (on windows) we got the log about
any error or something else that happen while it's trying to run...
can u share with me ur script package please?
> --
> 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/CAFLMo5_Yei_wTihS_YKdENLWnQFftPObAzVO5MKrrOd%3DBpjtLw%40mail.gmail.com.
>

melissa makonga

unread,
Nov 9, 2020, 12:22:50 PM11/9/20
to pyins...@googlegroups.com
No, I am only using --onefile but to package the exe I am using Pycharm.
This is what happen when I try to run it using command line

On Mon, Nov 9, 2020, 11:42 AM Brenainn Woodsend <bwoo...@gmail.com> wrote:
It sounds like you are using the `--windowed` option? If you are then don't. It means no output meaning you can never see any errors. Or possibly you are using Conda?

--
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/HYmG_zasD6o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
error.PNG

melissa makonga

unread,
Nov 9, 2020, 1:05:28 PM11/9/20
to pyins...@googlegroups.com
Are talking about the script that I am trying to convert or the .exe file inside the dist folder?

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/HYmG_zasD6o/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/CADcH5neHOo%3DTicpsvauBkfskKqt3V6v3R%2B9q9SMLSz3CDQsLXw%40mail.gmail.com.

Nurul Carvalho

unread,
Nov 9, 2020, 1:05:32 PM11/9/20
to pyins...@googlegroups.com
definitely, it's very strange...
but are u sure that u didn't use any extra file in ur script?
anyway, u can put the PressureGauge.exe file in the same folder as ur PressureGauge.py script and rerun it to see what's going next... 

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/CAF13mUwgv7utAytG3W_z1qfeU%3DvWd5c9cuw%2BSm-JPX6KN7ObuQ%40mail.gmail.com.

Nurul Carvalho

unread,
Nov 9, 2020, 1:58:18 PM11/9/20
to pyins...@googlegroups.com
the .exe file dear...
take it out from the dist folder and put it in the same folder as ur
script .py...
> https://groups.google.com/d/msgid/pyinstaller/CAF13mUyP0GpvQzXo0D0TmwYD3ksZzB2L36kS0RSdqgHrhjNcKA%40mail.gmail.com.
>

melissa makonga

unread,
Nov 9, 2020, 1:58:21 PM11/9/20
to pyins...@googlegroups.com
I am still getting the same output. Maybe it is because the file that I am working are on an external hard drive. Do you think that would cause an issue because I also tried to run it on powershell but got the same output

melissa makonga

unread,
Nov 9, 2020, 2:34:18 PM11/9/20
to pyins...@googlegroups.com
Oh!! Okay!! I did it!! And now I am getting this error. I don't know why
I am sorry

20201109_143107.jpg

Nurul Carvalho

unread,
Nov 9, 2020, 3:16:13 PM11/9/20
to pyins...@googlegroups.com
haham i'm seeing.. i thought this guide could help u...
but i want too..
please send screenshot of ur code..
i'm working with linux and my compile process is lil bit different
but anyway u just need to check if ur script (source code) is running like ur compiled program..
(in the same folder with the same file locations)

don't worry i'm here to help  with anything that i can...


pyinstaller-readthedocs-io-en-latest.pdf

melissa makonga

unread,
Nov 10, 2020, 3:35:07 AM11/10/20
to pyins...@googlegroups.com
for some reason, when I try to call the python script alone it does not open. I have to be in Pycharm in order to open.
Also, I was able to turn another python script into exe but I gave it to somebody else to run who was working another windows version, it could open but did not do anything

PressureGauge.pyw

Nurul Carvalho

unread,
Nov 10, 2020, 4:52:23 AM11/10/20
to pyins...@googlegroups.com
oh honey... this script requires many others modules some of them
aren't provided by pypi.org..
and others u can install by <pip install 'module_name'> command..
and u need to have the whole package to run it perfectly..
make sure u have it and first try to run the script.. then if it runs
very well u'll can compile it to an .exe file (with all his
dependencies)..

melissa makonga <makonga...@gmail.com> escreveu no dia terça,
10/11/2020 à(s) 10:35:
> To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CAF13mUyVa4%3D9m4Nj-yEcgrTJVvznQX426Qq_Vm%2BMbJyR8HoM-A%40mail.gmail.com.

bwoodsend

unread,
Nov 10, 2020, 4:23:55 PM11/10/20
to PyInstaller
Change your filename to use `.py` instead of `.pyw`. `.pyw` will implicitly add `--windowed` which will hide error messages. *Unable to find python38.dll* normally translates to you're using the weird unsupported python from the Windows store. Instead use the official version from python.org.

melissa makonga

unread,
Nov 30, 2020, 9:42:15 AM11/30/20
to PyInstaller
Hello, I am sorry it took me so long to give an update. I was able to package my script into an exe file but now  I am not able to run it properly. My GUI appears to be frozen instead of executing what it should do.

Nurul Carvalho

unread,
Nov 30, 2020, 1:27:59 PM11/30/20
to pyins...@googlegroups.com
hi Melissa.. pycharm got new plugin (code with me) can you install it
generate and share your link for we help you more efficiently..

or try to build folder with all his modules and dependencies instead
of --one-file.. and build it with a shell window!
> --
> 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/958d33b0-a062-4f9c-8bcd-7fc457b3306cn%40googlegroups.com.
>

Subramanian Ramajayam

unread,
Dec 1, 2020, 2:57:40 AM12/1/20
to pyins...@googlegroups.com
Hello, if you can send me the script, I will try. I had similar problem for 2 months before I overcame it. 
Srs

melissa makonga

unread,
Dec 1, 2020, 3:28:18 AM12/1/20
to pyins...@googlegroups.com
hello Nurul,
I have tried installing code with me but I was not able to do that, so I just went ahead used pyinstaller with the --onefile- and I was able to build the .exe file but I am still having the same problem

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/HYmG_zasD6o/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/CADcH5nfvc_yz9n4Ca4rTTf%3Dfocaa%2BOuTU%2B4LTEaTvJKe3fXQKg%40mail.gmail.com.

Rob V

unread,
Dec 1, 2020, 12:45:52 PM12/1/20
to pyins...@googlegroups.com
It is a big application - would there be an easier first step?  I can do this tonight when I get home from work.

Nurul Carvalho

unread,
Dec 2, 2020, 3:35:13 AM12/2/20
to pyins...@googlegroups.com
own it's a really big and laborious script..
Melissa.. Did you read the pyinstaller's guide?
it could help you with this and any other issues..

but if you already did and tried many things and nothing might solve this, maybe it is because you got a bug inside your script..
are you sure that you didn't use any extra file (like images or sounds) inside your script?
maybe you had, and your program.exe is trying to catch them.. and how it can not find them, it raises an error and interrupts the program.. 
🤔😕😓

melissa makonga

unread,
Dec 2, 2020, 4:20:35 PM12/2/20
to pyins...@googlegroups.com
So an error in the program could cause thhe script to not opening at all without detecting that error? Because for the external files, I am using a folder that I include in the dist folder created after compiling the script

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/HYmG_zasD6o/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/CADcH5ndq7h0TCVdQc3WwoMDFoRpZ9Qr3u_6RQRSG1Mb9o4tsLA%40mail.gmail.com.

Nurul Carvalho

unread,
Dec 3, 2020, 4:22:47 AM12/3/20
to pyins...@googlegroups.com
yes it does..
when any trouble occur inside of the script your debug got these
error.. but how you didn't make an shell window you'll can not see
these error!

try to modify your script's extension from .pyw and put only .py...

then try to rebuild your .exe file, without using "--nowindow"..

after this compilation your script will get a back-black-window like a
shell or prompt...
inside that window you'll can see any trouble that your py-debug will catch...

**(BUT BE WARNED.. IF SOME ERROR OCCUR AND YOUR PROGRAM FREEZE OR
CLOSE NEXT.. THAT WINDOW WILL ALSO CLOSE.. SO AFTER THIS BIG OPERATION
TRY TO OPEN YOUR .exe FILE FROM YOUR PROMPT AND YOU'LL CAN SEE THE
ERRORS SIMILARLY)
>>>>> https://groups.google.com/d/msgid/pyinstaller/CADcH5nfvc_yz9n4Ca4rTTf%3Dfocaa%2BOuTU%2B4LTEaTvJKe3fXQKg%40mail.gmail.com
>>>>> .
>>>>>
>>>> --
>>>> 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/CAKa7spPQ45_O2FuMDS61BpN3Lms4sM5avF3gJ3vv-X5pMUA5hw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/pyinstaller/CAKa7spPQ45_O2FuMDS61BpN3Lms4sM5avF3gJ3vv-X5pMUA5hw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAOik8AQgHaznOoYSrp0H2zG6BDXRY2gwCHwErp23KQyBQUeDWw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pyinstaller/CAOik8AQgHaznOoYSrp0H2zG6BDXRY2gwCHwErp23KQyBQUeDWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/HYmG_zasD6o/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/CADcH5ndq7h0TCVdQc3WwoMDFoRpZ9Qr3u_6RQRSG1Mb9o4tsLA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pyinstaller/CADcH5ndq7h0TCVdQc3WwoMDFoRpZ9Qr3u_6RQRSG1Mb9o4tsLA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> --
> 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/CAF13mUzBPk54cimgJ8TZppe%2BbDCrBMcrcoG2pGzMFSd03LOd%3Dg%40mail.gmail.com.
>

Ajith John

unread,
Dec 4, 2020, 5:32:31 PM12/4/20
to PyInstaller
Sir,

I created an application which reads a text file and displays results in GUI based on the values in text file. The code is working fine with spyder (Anaconda3). However when I create exe using pyinstaller, the exe is only showing a black screen without opening GUI. Code is given below.

Can anyone help me on this.

regards

Ajith John



import os

import pandas as pd

from tkinter import * 
# importing askopenfile function from class filedialog 
from tkinter.filedialog import askopenfile 

# Define variables to store values
UCMAX = int
UCMIN = int
TOT_VOL = float

#Function for deleting initial lines from original mms file and storing as dummy file
def delete_multiple_lines(original_file,dummy_file, line_numbers):
    """In a file, delete the lines at line number in given list"""
    is_skipped = False
    counter = 0
    # Open original file in read only mode and dummy file in write mode
    with open(original_file, 'r') as read_obj, open(dummy_file, 'w') as write_obj:
        # Line by line copy data from original file to dummy file
        for line in read_obj:
            # If current line number exist in list then skip copying that line
            if counter not in line_numbers:
                write_obj.write(line)
            else:
                is_skipped = True
            counter += 1


def Evaluate_file(): 
    file = askopenfile(filetypes =[('txt Files', '*.txt')]) 
    if file: 
        # create a list 
        lines = []
        # Store range of lines to be deleted 
        for i in range(0,71,1):
            lines.append(i)
  
        # Call delete line function with argument main text, dummy text files, initial rows to be deleted
                        
        delete_multiple_lines(os.path.basename(file.name),'dummy.txt',lines)


        #Read text file
        data = pd.read_fwf('dummy.txt',col_index=0,delim_whitespace=True,skipinitialspace =True,skip_blank_lines=True)

        #Delete invalid/unrequired rows
        data = data.dropna()

        #Delete second column which is not useful
        data = data.drop([0, 1])

        # Create Index column for better analysis
        data = data.reset_index()

        # Delete initial index column as the number is not continuous due to deletion of unwanted rows
        data = data.drop(['index'], axis = 1) 

        # Create Column Header row
        data.columns=["Status", "Values", "State", "CF", "G2M", "M2G", "OV", "UV", "Bypass_OWN", "BYPASS_PARTNER", "TEMP_ERR", "TEMP_HIGH1", "TEMP_HIGH2", "DRV_PWR", "UCE_SAT", "DCiUV", "DCiOV", "COMFLT_MI2GIB_COMFLT_GIB2MI", "COMFLTCntSUM_MI2GIB_COMFLTCntSUM_GIB2MI"]

        # Split the Values column as so many fields are merged while reading and store in new dataframe
        data1 = data["Values"].str.split(" ",expand=True,)

        #Delete unwanted columns in new Data frame with split fields
        data1 = data1.drop([0,3, 5,7,8,10,11,12,13,15,16,17,18],axis=1)

        # Remove unwanted : in sub module number field 
        data1[1] = data1[1].str.replace(':','')

        data1.columns=["SM_NUMBER","HEX1","HEX2","Operational","Voltage","Present_status"]

        # Delete the values column with so many fields & status column in original data frame which are not required
        data = data.drop(['Values'],axis=1)
        data = data.drop(['Status'],axis=1)

        # Merge temporary dataframe with splitted fields of values and original dataframe
        data = pd.concat([data1,data],axis=1)

        #Query for modules in block status and strore in dataframe
        data1=data.query(' Present_status == "HB_BLOCK" ')

        # Remove V from Voltage field
        data["Voltage"] = data["Voltage"].str.replace('V','')

        # Convert Voltage field to number
        data["Voltage"] = data["Voltage"].astype(int)

        #Find UC Max
        # print("UCMAX: ", data["Voltage"].max(), "Volts")
        UCMAX=data.loc[data["Operational"]=="Operational",'Voltage'].max()

        #Find UC Min
        UCMIN=data.loc[data["Operational"]=="Operational",'Voltage'].min()

        # Find total voltage in arm by adding voltages of capacitors whose SM status is ON
        TOT_VOL=data.loc[data["Present_status"]=="HB_ON",'Voltage'].sum()/1000


        data2 = data1[['SM_NUMBER','Operational','Present_status']]
        print ("\n Blocked submodules:\n", data2)

        #Update text boxes
        T1.delete("insert linestart", "insert lineend")
        T1.insert(END, UCMAX)  
        
        T2.delete("insert linestart", "insert lineend")
        T2.insert(END, UCMIN)                         
        
        T3.delete("insert linestart", "insert lineend")
        T3.insert(END, TOT_VOL)   
        
        T4.delete('1.0', END)
        T4.insert(END, data2)  
        
root = Tk() 
root.geometry('600x600') 

var = StringVar()
label = Label( root, textvariable=var, relief=RAISED )

var.set("Details will be displayed below after opening file")
label.pack(pady=20)

btn = Button(root, text ='File Open ...', command = lambda:Evaluate_file()) 
btn.pack(side = TOP, pady = 10) 

lbl1=Label(root, text='UCMAX in Volts').pack()


T1 = Text(root, height=1, width=10)
T1.pack(pady=10)

lbl2=Label(root, text='UCMIN in Volts').pack()


T2 = Text(root, height=1, width=10)
T2.pack(pady=10)


lbl3=Label(root, text='TOTAL ARM VOLTAGE in Kilo Volts').pack()
#lbl3.pack(side = LEFT)

T3 = Text(root, height=1, width=10)
T3.pack(pady=10)

lbl3=Label(root, text='Abnormalities').pack()
#lbl3.pack(side = LEFT)

T4 = Text(root, height=10, width=70)
T4.pack(pady=10)

mainloop()

Nurul Carvalho

unread,
Dec 6, 2020, 4:41:29 AM12/6/20
to pyins...@googlegroups.com
hello my brother i guess your bug is on last line..
you've supposed to write "root.mainloop()" not only "mainloop()"
> --
> 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/da41c1e0-41ae-4fd3-8f73-47e1454a95den%40googlegroups.com.
>
Reply all
Reply to author
Forward
0 new messages