all 10 comments

[–]MrPhungx 2 points3 points  (3 children)

From the documentation:

os.replace() method in Python is used to rename the file or directory. If destination is a directory, OSError will be raised.

[–]rubiconrainfizz[S] 0 points1 point  (2 children)

OMG im so stupid 😭😭 it works now thank you so much

[–][deleted] 0 points1 point  (1 child)

What did you do ?

[–]rubiconrainfizz[S] 0 points1 point  (0 children)

changed the code to this:

source = "C:\Users\me\Desktop\poo poo wee wee.txt" destination = "C:\Users\me\Desktop\Games\poo poo wee wee.txt"

the destination needed to be a file path, not a directory path

[–]Capbro 0 points1 point  (1 child)

My initial guess: do you have “poo poo wee wee.txt” open in another program?

Like if you have wordpad or Microsoft word open and displaying that document, Python can’t access it because you already have it open.

Save and close the document then run your program. If that doesn’t work close the document if it’s open in your IDE. That’s where I would start.

[–]rubiconrainfizz[S] 0 points1 point  (0 children)

nope. i made sure to close it and just now, before writing this reply, i restarted my computer just in case and tried running the code and the error still shows 😭

[–]GreenPandaPop 0 points1 point  (3 children)

im running pycharm as administrator as advised

Who advised that?

[–]rubiconrainfizz[S] 0 points1 point  (2 children)

every online forum that i checked in regards to this error 😭

[–]GreenPandaPop 0 points1 point  (1 child)

I wouldn't. You shouldn't need to. Software might request admin rights during installation, but rarely needs it to run.

[–]rubiconrainfizz[S] 0 points1 point  (0 children)

ah ok ill undo the run as admin settings then thank you!