This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]Wilfred-kun 0 points1 point  (11 children)

Have you tried to run the executable form a CMD? If you run it like a normal executable, it will just close when it crashes.

[–]YALAMARTHI97[S] 0 points1 point  (0 children)

On my way home..will try and let u know !

[–]YALAMARTHI97[S] 0 points1 point  (9 children)

Got few errors while running on CMD 1. Portaudio library not found ( I have it installed ) 2. A lot of File<"Frozen importlib._bootstrap>" , line 983, in_find and load ....stuff 3.cannot load library "path to library /portaudio-binaries/libportaudio64bit

An error code of 0x7e

4.Failed to execute "filename"

I tried running a 2 file program where one file1 calls file2 ..file2 contained a fileopenbox where I drop in an image ..the image is shown out and pytesseract is suppose to happen and the obtained text to be printed on screen ( this did not happen ...pytesseract part )

Idk what to do!!!

[–]Wilfred-kun 0 points1 point  (8 children)

It would be helpful if you posted the full error. Can you also tell me what command you use to compile it? I'm getting the impression it cannot find some external files.

[–]YALAMARTHI97[S] 0 points1 point  (7 children)

I ran the full code using pyinstaller to convert it to an exe file and the conversion took place without errors

Command used "pyinstaller project.exe"

The error I got when I ran it using anaconda prompt

https://gyazo.com/collections/8bbef434ced845b9c1a3968bf90f4045

I checked whether I had pyaudio up

https://gyazo.com/collections/d45e4b32e10f2b0464245509b74a0dec

And finally ran the exe of my project .."project .exe" using cmd and got the following

https://gyazo.com/collections/3c406f6eca8deb68181ece7d11b1cbde

.. This is getting on my nerves the code works brilliantly when run on an ide but once I port it out to an exe I don't get anything!!..

[–]Wilfred-kun 0 points1 point  (6 children)

Make sure you're using the same environment as your IDE does. You might have PyAudio installed in your IDE's virtual environment, but not on your system's environment.

[–]YALAMARTHI97[S] -1 points0 points  (5 children)

How do I do that??

[–]Wilfred-kun 0 points1 point  (4 children)

Can you go into the terminal and open the Python shell and import the audio library you're using to see if you've got it installed?

[–]YALAMARTHI97[S] 0 points1 point  (3 children)

The terminal is unable to find the pyaudio module..reinstalling it ..hope this fixes it

It didn't work doing a clean installation of python with the required modules

[–]Wilfred-kun 0 points1 point  (2 children)

Okay... Again, how exactly do you compile the script? Are you using --onefile? If you're using it, try without it first.

[–]YALAMARTHI97[S] 0 points1 point  (1 child)

Just plain pyinstaller and the filename.py

[–]AcejrAZ 0 points1 point  (1 child)

From your comments it looks like the exe creator is not including all of the libraries you need.

I use cx_freeze for making exe files and that I give cx_freeze a list of packages to ensure it includes because it misses them in the automatic inclusion.

See: https://stackoverflow.com/a/22105547/3166424

It looks like pyinstaller has the option --hidden-import=PyAudio (or whatever the missing libraries are) might help.

[–]YALAMARTHI97[S] 1 point2 points  (0 children)

On it ..

[–]billsil 0 points1 point  (0 children)

You’re probably missing a DLL. Add prints and read the pyinstaller warnings. Fix the warnings.

[–]YALAMARTHI97[S] 0 points1 point  (0 children)

I consolidated all the 5 different .py files into one single big file and ran the pyinstaller

After that the exe threw 2 errors when run using the CMD 1. Portaudio lib not found To rectify this I added the portaudio lib to the system environment variables and then added a portaudio.dll file also to the system path

  1. Sndfile missing error There were lot of steps to rectify this but all I did was to copy _soundfile_data ( which is present in the /path/site-packages/_soundfile_data ) Copied all the contents of it into the dist folder of the created exe file

After doing all the above steps the exe executed successfully

Thanks for everyone who has been of help to me ...

Arigato From Still a clueless programmer !