1

im practicing my python skills so im trying to understand a code. And there is a code like this

   fig.savefig("../figs/SerialDist.png")

But i get an error:

"No such file or directory: '../figs/SerialDist.png'"

And as i already said im pretty new in this, but i think that the problem is that my file path is wrong, so f how can i fix it. Thank you.

4
  • 1
    Do you have the figs folder created? If not, consider creating it and testing your code again. Commented Aug 2, 2021 at 16:56
  • 1
    You could try something like this: stackoverflow.com/questions/54401973/… Commented Aug 2, 2021 at 16:56
  • @George But where should i create that folder? If i write cd it says "C:\Users\MyName". Commented Aug 2, 2021 at 16:59
  • 1
    ../figs/SerialDist.png means that the script will try to save your figure in the figs folder located one directory up from your current directory. E.g. if you run the following script C:\MyApp\scripts\script.py then ../figs/SerialDist.png is C:\MyApp\figs\SerialDist.png Commented Aug 2, 2021 at 17:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.