Renaming project root directory in PyCharm gives java.io.IOException
Asked Answered
P

6

15

I know it might be bad idea to rename project root directory, but while doing it I got following error:

enter image description here

I did it as follows:

enter image description here

enter image description here

Cant I really rename project root directory? How this option works? Is their any way to close the project (and all its files) in PyCharms and then rename?

Peristome answered 13/5, 2019 at 7:57 Comment(4)
Well, close PyCharm, rename folder with your favorite file manager and reopen the project.Wristlet
But doesnt PyCharm keeps root folder path in project settings, like workspace.xml? Do I have to modify them manually if I rename directory from file manager but not from within PyCharm?Peristome
Did you try it?Wristlet
Looks like some other program is currently using the folder and blocks renaming.Weevily
S
38

I had the same exception occurring. The java exception indeed indicates that something is using the folder (or contents within the folder). Stupidly, for me this was the python console within PyCharm. Within PyCharm, click on your python console and type exit() and hit enter. Then repeat your previous steps of refactor --> rename and you should be able to rename the directory. Note that the old folder will still be present at the directory it existed with only the .idea folder and files present.

EDIT: This was working last week, but now it randomly fails. Which would seem like something else is keeping the folder or contents occupied. For now it seems that waiting 5 to 10 minutes not doing anything allows renaming. Perhaps PyCharm keeps working on the folder in the background and you wait until it is done with whatever it is doing?

Sacramental answered 3/4, 2020 at 14:23 Comment(4)
Idea terminal was in the directory to be renamed in my case.Aeriform
In WebStorm, I had Angular server running that prevented this from happening. I stopped and renamed it and it worked!Caduceus
Related bug: youtrack.jetbrains.com/issue/WI-16062Lubricant
Thanks. Sometimes we miss minor things. In my case, project directory is being is used by CMD.Lukasz
C
2

I had the same issue, but when I closed all processes in that folder / its nested folders, the rename operation was completed successfully.

Cathay answered 6/10, 2021 at 9:13 Comment(0)
C
1

For me the issue was my node server was running while I was trying to rename the folder, so I had to close the server first and then rename the folder.

Cindacindee answered 3/1 at 13:21 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Hypsography
R
0

Same problem here, it seems like some process or something is using the folder. Closed the PyCharm terminal and stopped my Running configuration solved the problem.

Rich answered 28/2, 2022 at 8:30 Comment(0)
P
0

Opening "Task Manager" and terminating Python activity worked for me

Peon answered 21/10, 2022 at 18:10 Comment(0)
S
0

In my case it was just a deep structure with several subfolders. Move only worked for folders without subfolders.

Workaround was to copy the folders to new dir, remove the folders from the old dir and then gobally rename the paths in the imports.

So, no issues with running processes in the background in my case. IDE v 2023.1.6

Scientistic answered 15/8 at 7:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.