0

I am new to VS Code, so I appreciate your help and guidance. Here's the issue that I have encountered for days:

import numpy as np                                                             # linear algebra
import pandas as pd                                                            # data processing
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing, model_selection, metrics
from sklearn.preprocessing import MinMaxScaler
from keras.preprocessing.sequence import TimeseriesGenerator                   #Tensorflow has to be installed for this module
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM

Output:

ValueError                                Traceback (most recent call last)
File c:\Users\dbansal\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py:89, in _tempfile(reader, suffix)
     88 try:
---> 89     os.write(fd, reader())
     90     os.close(fd)

File c:\Users\dbansal\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py:371, in Traversable.read_bytes(self)
    368 """
    369 Read contents of self as bytes
    370 """
--> 371 with self.open('rb') as strm:
    372     return strm.read()

File c:\Users\dbansal\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py:54, in DegenerateFiles.Path.open(self, mode, *args, **kwargs)
     53 def open(self, mode='rb', *args, **kwargs):
---> 54     raise ValueError()

ValueError: 

During handling of the above exception, another exception occurred:

PermissionError                           Traceback (most recent call last)
c:\Bansal Data\Drishti Data\Self\iCode\Projects\AI project\EDA.ipynb Cell 1 in ()
      5 from sklearn import preprocessing, model_selection, metrics
...
---> 95         os.remove(raw_path)
     96     except FileNotFoundError:
     97         pass

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\...myname...\\AppData\\Local\\Temp\\tmpo1nk6sl3'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

I don't know what to make sense of this output or error. I have tried looking up other solutions but still not getting it.

This error happened so many times in a global and virtual environments in VS Code. I know a good amount of Python, but not the path related issue or anything behind that. I hope that I learn from you and I get better at resolving the issues. Thank you!

Peter Macej
  • 4,831
  • 22
  • 49
wafersD
  • 1
  • 1
  • It's interesting that you didn't show us any of the actual code. You are trying to delete a file that is still open, probably by your own code, but we can't tell that without seeing the code that leads up to line 95. And it says you have an `.ipynb` file. Are you running VSCode, or are you running Jupyter? – Tim Roberts Jul 06 '23 at 20:03
  • Really? I closed all the windows or applications so that I could re-start my project, but once I run this cell (consists of multiple libraries), I got this error. I am running Jupyter within VSCode. – wafersD Jul 06 '23 at 20:10
  • Right. I'm saying that YOUR CODE, in this same file, has this file open. Show us the whole cell. – Tim Roberts Jul 06 '23 at 21:42
  • Check if the file is being used, try closing vscode and reopening. Of course your files may be being used by other applications, only you can check this. There may also be processes using files elsewhere in your code. Please see [how to ask](https://stackoverflow.com/help/how-to-ask). [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – JialeDu Jul 07 '23 at 06:37
  • Thank you all, I know that I am late, but I was able to fix the issue. It was the extension issue, so I had to remove all the extensions from the local server and it worked but it also means that I had to start over from the beginning such as installing extensions within VS Code. – wafersD Jul 15 '23 at 22:29
  • Welcome to StackOverflow. If you find the solution, Please consider answering it and accepting it as an answer to change its status to Answered. It will also help others to solve a similar issue. See [can I answer my own question..](https://stackoverflow.com/help/self-answer), Just a reminder :) – JialeDu Jul 18 '23 at 07:59
  • May I know what's going on with the problem? If it has been solved, can you change the status of the answer to help more people with similar problems. – JialeDu Jul 31 '23 at 02:10

0 Answers0