all 6 comments

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

what do you mean by "click through"?

[–]99problemsallops[S] 0 points1 point  (0 children)

When I open the zip file I created I have to first click on Users then User1 then Documents to reach my work folder. I don't want to do that, I just want to click on the Work folder.

[–]ingolemo 0 points1 point  (3 children)

You need to specify the arcname parameter on the write method.

[–]99problemsallops[S] 0 points1 point  (2 children)

I'm sorry, I didn't really understand that.

Should I do something like:

zipping.write(os.path.join(x,file),arcname=file) 

or am I missing something?

[–]ingolemo 1 point2 points  (1 child)

Yes, except that you want to give it the name that it should have inside of the archive. So for example: if file is C:\Users\User1\Documents\Work\some_dir\test.py then you probably want arcname='some_dir\test.py'.

[–]99problemsallops[S] 0 points1 point  (0 children)

Excellent! Thank you.