0

So I was making a python bot, that sends results of it's work to Telegram. it was working until yesterday. Now when im starting it it returns this error:

 File "E:\FindBot\handlers\users\start.py", line 4, in <module>
   from loader import dp
 File "E:\FindBot\loader.py", line 11, in <module>
   with open("include/sc_prices.json", encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'include/sc_prices.json'

Python verison 3.9 IDE Pycharm

Doubleckecked the path to file 100+ times, and if i want to insert absolute path to this file - start.py runs without any errors, but telegram bot itself isnt working, just returns "Process finished with exit code 0"

As i mentioned before, everything was fine until yesterday, nothing was changed in code, also reinstalled all libraries and reinstalled windows

Pudge
  • 1
  • 1
  • Does ```include``` exist? Does ```include/sc_prices.json``` exist? It's better not to use a fixed ```include/sc_prices.json``` but use something less platform dependent as ```include/sc_prices.json``` is a Unix thing. have you tried using ```os.path.join```? "It was working until yesterday..." What changed? – ewokx May 21 '23 at 23:53
  • The code will look for `include/sc_prices.json` as a subfolder of **the current directory**, which is not necessarily the same directory where **your python script is**. To see what the code is using as the current directory, you can use this `import os; print(os.getcwd())` – John Gordon May 22 '23 at 00:32
  • On a side note, why on earth would you **reinstall windows** to fix a simple missing file error?? – John Gordon May 22 '23 at 00:34

1 Answers1

0

try using os.path to form path

check venv