I have encountered an issue where I have a file in Onedrive that I am not able to move. I have determined that, despite it saying that the action cant be completed because the folder or file is open in another program, it is not being used by another program.
I have come to this conclusion by using resource monitor to check which apps are using the folder. There are none besides file explorer.
Context as it's probably important:
The reason why this has happened is that i deleted a python venv in the file directory, resulting in my VS Code interpreter breaking. I have restored this venv file but the issue still has not been fixed. According to this post, it is the result of workspace links, however, I have never once used workspaces. The general idea that a file WITHIN that unmovable directory could be the reason though, and as a result, is possibly why this issue may be occuring. What does not make sense is why it is still happening even without VS Code running or any service connections being made as evident through resource monitor
Another thing to note is that the folder has not completely synced, however, based on past experience, this should not be an issue.
I successfully moved the file via terminal, however the issue still remains about why i could not simply move the file with file explorer.
Related
I am currently learning to code with python in vscode but recently I have been having problems with file seemingly deleting themselves after attempted execution (image 1). I have tried Ctrl+z and I have tried recovering them but neither have worked. The files are not in my recycling bin either. If I try to create a new file of the same name in the same folder it shows me a error message (image 2) of "unable to resolve non-existing files"
When I execute my code the file saves but then becomes deleted:
This message appears if I try to undo the delete:
Have you tried to restart vscode? It is recommended that you could try the following aspects:
Check if there is any effect caused by the related expansion. For example, LaTeX Workshop extension has the function of cleaning generated files.
Check your setting.json Files,clear the contents of the user setting.json file and the vs code will return to the default value.
If it still doesn't work, you could consider installing vscode again.
Try running the Python file through a command prompt or terminal using the command python <foo_file_name>. Doing this will either confirm or deny the theory that #jasonharper made in the comments.
If you can run the script that way then we know that #jasonharper was correct and somehow your execute button/command was tampered with.
I had a similar issue using a different programming language. Building generated a file that got deleted automatically.
In my case the Windows 10 default antivirus was the cause. Turned off real-time scanning, tried again and then my files weren't deleted.
Adding an exception for the folder fixed it.
I had the Same problem with a PHP file, and turns out it wasn´t VS CODE. It was my antivirus that was moving the file to quarentine!!
I have a short script written in python that saves a simple .txt to the same directory the .py file is in. Problem is: It only does so on one of my two computers.
My code doesn't include a hard-coded path to write to. On my laptop, I can put the makemeanote.py in any folder and it will create the note right there. On my desktop pc, all the notes end up in System32. PATH is set exactly the same way on both machines, and both use Windows\py.exe as the executable.
Somewhat interestingly, I only get an admin-screen on the desktop pc, asking if I want to allow changes to my system by "Built: Release_master_v3.8.2_"etc., whereas on my laptop it simply runs and does its job.
No amount of un- and reinstalling has changed anything, even when I thought I had eradicated any trace of python on my hard drive. Both PCs use current Win10/64 installations.
What is happening there?
A clarification: It's not about fixing the bug, it's about understanding the inconsistent behaviour! I know I could just hard-code any directory, but that takes away the beauty, don't you think?
I finally found the cause of the weird behavior:
For some reason, the py.exe in my WINDOWS folder was set to always be run as admin. As soon as I unchecked that option, the User Account Control (UAC) check disappeared and my file finally behaved as I had expected.
I am brand new to python and programming more generally so 1) I'm an ignorant noob and I apologize and 2) I'm really just using IDLE for very basic learning. I'm running python 3.7.6 on Mac OS Catalina 10.15.3
My problem is bizarre: When I go to save a new .py file, IDLE freezes and becomes unresponsive. I'll hit CMD+S on a new/'Untitled.py' file, the save folder will pop open, and I can name the new file/navigate folders, but once I hit "Save", the program freezes with the save folder still open, except now the Save/Cancel buttons are greyed out and the entire application becomes unresponsive. My only recourse is to Force Quit and relaunch IDLE, and the new file I was trying to save never saved. You can imagine how fun this is.
What's weird is it doesn't happen every time. If I open IDLE, open a new file and very quickly/immediately save (which I try to do by default), then the file will save. Once I've saved it once, I have no problems saving the existing file as I work on it. That is, the issue is only with the creation/save of new files. I'm also not sure why sometimes I can Save a new file and other times (especially if IDLE has been open for a while) it crashes.
To be clear: I can open files, save existing files, and run programs I've written without incident. I am not getting any warnings, crash notifications, or notices of any kind that even acknowledge that IDLE is acting up.
I had 3.8, which I replaced for 3.7.6 thinking a more stable version might solve my problems, but no dice. I only have python 3.7.6 on my computer: No python 2, nothing else. I have no idea what's going on but this is super frustrating and I just want to be able to learn Python without these weird roadblocks.
Please help!
I've also had this problem, and what I did was change the location of where the file would save. I suggest trying this to help.
I'd suggest reinstalling python idle (your programs will be saved). If this doesn't work then maybe it has something to do with your security on the mac.
I had the same problem, and as Aadi suggested, I was able to fix it by changing the location of where the file was saved. Possibly, this relates to very long paths, at least in Windows 10.
The path that didn't work was 114 characters long. The path that did work was 93 characters long. The paths are the same up to character 80 and use underscore (_) but no unusual characters.
You don't have to make/save python files in IDLE. You can open any text editor, type the code, and save as name.py. Then you can open that in IDLE. I would use that for now.
I also came across with same issue, this is only issue of currupt file,please delete recent python IDLE file that you have created,this will definately work
I am having a problem with PyCharm (Community Edition) in that, when I open a .py file in the program, I can happily read and write in the file as usual, however when I click out of PyCharm (to look my emails for example) and then click back into it to carry on with my code, the file automatically closes and the project tree structure collapses (so I have to re-open it every time).
So far I have tried changing the tab limit to a high number, but this doesn't seem to help (and it shouldn't be related, since this happens when I open just one file).
I had the same issue before. I'm assuming you're connected to a network shared folder via UNC path (e.g. \\foo\bar\)?
If so, it is not currently supported. You'll need to map your network folder and give it a Drive letter. Then load up your project using the mapped drive, and it'll work like a charm.
If that's not the scenario though, please give us more information.
My current project tree:
redditbot/
-- commands/
----__init__.py
----comment_cache.txt
----readcomments.py
--mainbot.py
What I am attempting to do is read the comment_cache.txt file via open('comment_cache.txt')in the readcomments.py file., but for some reason I am getting a FileNotFoundError. Even when I try print(os.path.isfile('comment_cache.txt')), it just returns false.
Am I making a beginner mistake here? Maybe something that just I keep missing?
EDIT: I appreciate all the answers/comments, but I believe it is a problem with my Python interpreter itself. I kept moving around the file between the redditbot/ directory and the commands/ package until it just started working. Also for some reason whenever I call print(), PyCharm tells me that it is undefined...
I am assuming that mainbot.py is the entry point from where you run your application, so
Problem I
based on your project tree, the file should be available at path
open('commands/comment_cache.txt')
Problem II
I kept moving around the file between the redditbot/ directory and the commands/ package until it just started working.
You probably ended up placing the file in the same folder as your mainbot.py
Problem III
Also for some reason whenever I call print(), PyCharm tells me that it is undefined...
There can be many posibilities behind this, check if the python interpreter is configured correctly and the python libraries are available on the PYTHONPATH for the project