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 6154217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:13:38+00:00 2026-05-23T20:13:38+00:00

I made this code into an executable with py2exe: # File: zipfile-example-1.py from Tkinter

  • 0

I made this code into an executable with py2exe:

# File: zipfile-example-1.py
from Tkinter import *
import zipfile
import os
import glob
Admin = Tk()
Admin.configure(bg='grey')
La = Label(Admin,bg='grey', text='Dir to back up.')
La.pack()
Ent = Entry(Admin, bg='grey')
Ent.pack()
la = Label(Admin,bg='grey', text='Zip file name.')
la.pack()
ent = Entry(Admin,bg='grey')
ent.pack()

def zipdir():
    fi = ent.get()
    fii = fi+'.zip'
    pl = Ent.get()
    pll = pl+'/*' 
    file = zipfile.ZipFile(fii, "w")

    # list filenames
    for name in glob.glob(pll):
        print name
        file.write(name,os.path.basename(name),zipfile.ZIP_DEFLATED)

    file.close()
    file = zipfile.ZipFile(fii, "r")
    for info in file.infolist():
        print info.filename, info.date_time, info.file_size, info.compress_size

Bu = Button(Admin,text='Backup.',command=zipdir)
Bu.pack(side=RIGHT)
Admin.mainloop()

When I run it I get this in the console:

Traceback (most recent call last):
  File "zip.py", line 3, in <module>
  File "zipfile.pyc", line 462, in <module>
  File "zipfile.pyc", line 474, in ZipExtFile
AttributeError: 'module' object has no attribute 'compile'

Im pretty sure its source code from my other music downloading program.
I’ve already tried to reinstall Python, reinstall py2exe and scanned for viruses.

I’m using Win 64 Python 2.7.1 Windows 7.

Does anyone know why I get this error?

Never mind i ran it again after compiling it into a exe again and it worked odly enough.

  • 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-23T20:13:40+00:00Added an answer on May 23, 2026 at 8:13 pm

    You can’t have dashes in the name of a Python module. And you can’t call a Python module zipfile, because there’s already a standard library module with that name. Does it work if you rename it to z.py, before you run py2exe?

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

Sidebar

Related Questions

Bumped into some code like this in our code base... which made me worried.
I made this code with jQuery to fade images ( but not the one
How can I improve this code? What has made this long winded is the
I am pretty new at C# and .NET, but I've made this code to
Ok. I've made this awe-crap-code Exporting table to XLS (but still no idea how
i made a windows service & add project installer.in which only contain this code.
I have roughly the following code. Could this be made nicer or more efficient?
Hey. I know this is not a 'refactor my code' site but I made
This code is to be integrated into an AJAX Chat system to enable a
i have this json structure and I made it into an array. I was

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.