0
File Not Found Error
I created a python program to wish my friend. I used some modules and created some modules for myself and imported them in the main python file. Everything is perfect. Code ran successfully. Then I converted that py file to exe file using pyinstaller. There a problem arrives. It throws File Not Found Error. All the required files are in the working directory but still I got that error. I didn't find a single video or description on the google. Can anyone help me?
17 Answers
+ 2
Pardha Saradhi the error exists in your arts/example.py, file in the last line
"""
with open("PyWishCode.py") ......
"""
Here Python is trying to find the file "PyWishCode.py" in arts directory but it is in its parent directory.
That's why it throwing FileNotFound error.
Either correct the path or remove that piece of code (if its useless).
+ 3
Are you using external files and which type of files?
Can you post your code?(of that part where you are creating/opening file)
+ 1
AKSHAY🇮🇳 https://drive.google.com/drive/folders/1NMgCeo78WksrtlQT-VKJ824CnhaaRggT?usp=sharing
Check that drive link for code.
I used one gif image in love.py but I didn't share that with you because it's personal. I hope you can understand 😊
Main python file is PyBirthdayWish.py
+ 1
How can I share a screenshot? I don't know how to share here
+ 1
AKSHAY🇮🇳
Done 👍 I uploaded the screenshot in Google drive. Please check it
+ 1
AKSHAY🇮🇳
I commented out that part and it's working. But I got 3 more problems.
1) Exe file is getting executed after a long time. It is taking so much time to start.
2) output is in different format. The Design which I used in the program is not showing on the screen. It took the screenshot and uploaded in the Google drive.
3) I want terminal to fit full screen by default. But it's not fitting full screen size.
+ 1
Pardha Saradhi
1-> yes it will execute slowly as python is a sloooww language.
3-> You can cannot control over terminal screen that opens after executing, you can use PyAutoGui to manage what appears on desktop.
2-> I will look for it.
also comment out that part in other files in arts directory
+ 1
Yeahh. I commented out all useless codes
+ 1
Pardha Saradhi lets continue the conversation in DM.
0
Pardha Saradhi
Your code looks correct,
Can you share the screenshot of error also.
I doubt python is not treating your "arts" folder as a package, create a blank __init__.py file in your arts directory.
There is also one more option, let me know if this works
0
No it's not working 😔
0
Pardha Saradhi
Then I suggest you to use auto-py-to-exe (install through pip)
This is also based on PyInstaller but it gives a GUI interface to ease your work.
In auto-py-to-exe you will see a option to include files and folder for your application, there you can include the remaining files and folder.
After creating exe with above methods, your all extra files will be stored in temp storage (if you delete them, your program will automatically regenerate them) and in front you get only single exe file (if you choose window mode, option in auto-py-to-exe) that will work as you want.
0
AKSHAY🇮🇳
I tried auto-py-to-exe. But it fails. Still it gives File not found error
0
Pardha Saradhi
Can you share the screenshot of error
0
Pardha Saradhi go on you profile section then in post and share link
0
Pardha Saradhi
If you are facing problem to upload screenshot on Sololearn then you can upload it in your google drive folder that you shared above