Mar-23-2018, 07:51 PM
Now that I VScode to program with I have been making some stuff and getting used to the new program but I am having one problem. I have this line of code that opens a file with pickle. The line of code that I have will run if I double click the python file or run the code from the python IDEL but when I run it from VScode it says that it can't find my file. I assume that it is not looking in the right location but I don't know how to make it look in the right location. I tried to use os.path.join to give the directory of the file but I think I did it wrong because it did not work. The file is located in the same location as my program.
This is the code. Works if I run outside of VScode.
This is the code. Works if I run outside of VScode.
f = open('images.lib', 'rb')This is what I have tried but did not work.
f = open(os.path.join('C:\Users\User\Desktop\Python\New folder\Number Game','images.lib'), "rb")