Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:03:52+00:00 2026-05-13T09:03:52+00:00

I am a newbie going through a byte of python (3.0). This is the

  • 0

I am a newbie going through a byte of python (3.0). This is the first programming language I have ever used. I am stuck at the point where you make a simple program that creates a backup zip file (p.75). I’m running Windows 7 (64 bit) with python 3.1. Prior to this I installed GNUWin32 + sources, and added C:\Program Files(x86)\GnuWin32\bin to my Path enviornmental variable. This is the program:

#!C:\Python31\mystuff
# Filename : my_backup_v1.py

import os
import time
# backing up a couple small files that I made
source = [r'C:\AB\a', r'C:\AB\b'] 

#my back up directory
target_dir = 'C:\\Backup' 

#name of back up file
target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'


zip_command = "zip -qr {0} {1}".format(target,' '.join(source))

print(zip_command)

if os.system(zip_command) == 0:
    print('Successful backup to', target)
else:
    print('Backup failed!')
    print('source files are', source)
    print('target directory is', target_dir)
    print('target is', target)

Output:

zip -qr C:\Backup\20100106143030.zip C:\AB\a C:\AB\b
Backup failed!
source files are ['C:\\AB\\a', 'C:\\AB\\b']
target directory is C:\Backup
target is C:\Backup\20100106143030.zip

The Tutorial includes a little bit troubleshooting advice: copy and paste the zip_command in the python shell prompt to see if that atleast works:

>>> zip -qr C:\Backup\20100106143030.zip C:\AB\a C:\AB\b
SyntaxError: invalid syntax (<pyshell#17>, line 1)

Since that didn’t work, the tutorial said to read the GNUWin32 manual for additional help. I’ve looked through it and have yet to see anything that will help me out. To see if the zip function is working I did help(zip) and got the following:

>>> help(zip)
Help on class zip in module builtins:

class zip(object)
 |  zip(iter1 [,iter2 [...]]) --> zip object
 |  
 |  Return a zip object whose .__next__() method returns a tuple where
 |  the i-th element comes from the i-th iterable argument.  The .__next__()
 |  method continues until the shortest iterable in the argument sequence
 |  is exhausted and then it raises StopIteration.
 |  
 |  Methods defined here:
 |  
 |  __getattribute__(...)
 |      x.__getattribute__('name') <==> x.name
 |  
 |  __iter__(...)
 |      x.__iter__() <==> iter(x)
 |  
 |  __next__(...)
 |      x.__next__() <==> next(x)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __new__ = <built-in method __new__ of type object at 0x1E1B8D80>
 |      T.__new__(S, ...) -> a new object with type S, a subtype of T

Unfortuneatly I can not really understand the ‘help’ yet. However I played around a bit with the zip function to see how it works.

>>> zip (r'C:AB\a')
<zip object at 0x029CE8C8>

So it appears that the zip function works, but I guess I’m not using it correctly. Please help me out, and keep in mind I haven’t had much experience with programming yet. If you would like to view the tutorial you can find it at http://www.swaroopch.com/notes/Python .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:03:53+00:00Added an answer on May 13, 2026 at 9:03 am

    The reason “zip -qr C:\Backup\20100106143030.zip C:\AB\a C:\AB\b” failed at the prompt is because in this case, “zip” is supposed to be a command you’re sending the operating system… nothing to do with Python.

    This is a little confusing, I’m afraid – when you did “zip(r'C:AB\a')“, you were using Python’s built-in zip() function, which is unrelated to what you’re trying to do.

    Do you have the proper directory struture? I mean, do C:\AB\a and C:\AB\b exist?

    Edit – You should copy/paste that long “zip” line to the command prompt (hit windows key + R, then type “cmd” and hit enter), to see if it works; not the Python shell.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am complete newbie in mod_rewrite , and I have been going through some
I am a python django newbie, and was going through some open source code,
Some newbie questions. First, I would love to get this plugin: http://archive.plugins.jquery.com/project/getAttributes but I
I'm 100% sure this is going to be one of those newbie questions, but
I was going through the Python tutorials and I decided to create a little
this is going to be a total newbie question but I can't really do
JavaScript newbie here, I was going through some js code at work when i
I'm a newbie to jQueryMobile. When I'm going through the documentation and sample, I'm
I am used to programming in python and am trying to learn javascript. I
Disclaimer: I'm a rails newbie, so I apologize if I'm going at this problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.