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?

29th Aug 2021, 1:10 PM
Pardha Saradhi
17 Respostas
+ 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).
31st Aug 2021, 3:28 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 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)
29th Aug 2021, 2:05 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 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
30th Aug 2021, 6:29 AM
Pardha Saradhi
+ 1
How can I share a screenshot? I don't know how to share here
31st Aug 2021, 7:08 AM
Pardha Saradhi
+ 1
AKSHAY🇮🇳 Done 👍 I uploaded the screenshot in Google drive. Please check it
31st Aug 2021, 1:31 PM
Pardha Saradhi
+ 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.
31st Aug 2021, 5:15 PM
Pardha Saradhi
+ 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
1st Sep 2021, 4:00 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
Yeahh. I commented out all useless codes
1st Sep 2021, 4:06 AM
Pardha Saradhi
+ 1
Pardha Saradhi lets continue the conversation in DM.
1st Sep 2021, 6:49 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
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
30th Aug 2021, 6:57 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
No it's not working 😔
30th Aug 2021, 5:34 PM
Pardha Saradhi
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.
31st Aug 2021, 3:28 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
AKSHAY🇮🇳 I tried auto-py-to-exe. But it fails. Still it gives File not found error
31st Aug 2021, 5:05 AM
Pardha Saradhi
0
Pardha Saradhi Can you share the screenshot of error
31st Aug 2021, 5:10 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
Pardha Saradhi go on you profile section then in post and share link
31st Aug 2021, 7:09 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
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
31st Aug 2021, 8:39 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar