Search code examples
pathshutil

Permission error for shutils moving png to path


You see I am making a python gui with pysimplegui for my old qrcode generator script so im using shutils for the user to download the file.

I am using the 'default' thing because i want it to save to my users path not mine, do you know some other way I can do that? because i think this is the reason its not working

I tried making it so the user inputs there username such as 'My laptop' so it adds it to the path

src_path = r"D:\Python\QRcode generator\output.png"
dst_path = r"C:\Users\Default\Pictures"

shutil.move(src_path, dst_path)


Solution

  • The code is correct. It wont give any error if you dont use C drive (Where the operating system is installed)

    This is mostly due to C drive is protected for windows stability.

    If you are using any code editor (Pycharm, VS Code etc.) or running the code in windows command prompt or any terminal etc. Try and run it with administrator rights

    It should work.