solved:

os.chdir(path)

Hope that helps someone!

On Dec 20, 10:13 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I'm unpacking files in a .zip and need to save each file into a
> particular directory, but I can't seem to find a way to set the
> directory to save into. Here is part of my code where I'm opening
> the .zip and iterating over the files:
>
> thumb_zip_file = zipfile.ZipFile(obj.thumbnail_image_zip_archive, 'r')
>
>     for thumbnail_file in thumb_zip_file.infolist():
>         fname = thumbnail_file.filename
>         data = thumb_zip_file.read(fname)
>         fout = open(fname, 'w')
>         fout.write(data)   # <-- here's where I need to specify a
> directory
>         fout.close()
>
>     thumb_zip_file.close()
>
> Can anyone explain how to set the directory to write into? The above
> code writes out the files from the .zip, but it writes them to my
> project root.
>
> TIA,
> Brandon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to