0

I would just like to say off the bat, that I am very new to programming and this could be a real quick fix.

I am having trouble running a python script out of a standard VS Code from my 'base' conda env: python 3.7.6, but for some reason the same code when transferred into a jupyter notebook or even ran from the makeshift jup notebook on VS CODE it works fine.

When I run the code in the standard VS Code with the same python interpreter, I continue to have the following errors:

I would really like to learn how to avoid this in the future, because I prefer to write in VS Code modules instead of out of Jup. Notebooks.

Thanks for the help!

    data= pickle.load(open('myData.pickle','rb'))
_pickle.UnpicklingError: invalid load key, '\xef'.

Here I also attached the image of the jup notebook output to show that the code runs fine on its own when not in a standard script .py file. Since I am new, the best I can do is leave the link to the image.

  • Are you going from CPU to GPU environment? – Kuldeep Singh Sidhu Jul 09 '20 at 04:53
  • How might I identify which one is which. I guess my answer is I don't truly know how to tell when im in GPU vs. a CPU env. – John Feldhausen Jul 09 '20 at 15:00
  • Welcome to SO. I haven't used pickle so I don't know it off the top of my head. A brief SO search gave me this: https://stackoverflow.com/questions/33049688/what-causes-the-error-pickle-unpicklingerror-invalid-load-key and you might find something good there. – EngrStudent Jul 09 '20 at 15:26
  • Unfortunately when i tried the gzip technique and looked at this it didn't work either... also i think its important to note that when I try running this exact code on a Mac in VSCode it works fine, but on my PC it only works in Jupyter Notebook. Why does anyone know why that would be? Thanks so much! – John Feldhausen Jul 10 '20 at 18:43
  • @John Feldhausen Try running the python script using the system's cmd window to check if it happens again.This can check whether the cause is from vscode. – Jill Cheng Jul 23 '20 at 09:33

0 Answers0