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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:42:32+00:00 2026-06-09T05:42:32+00:00

So, I’m trying to unzip a .jar file using this code: It won’t unzip,

  • 0

So, I’m trying to unzip a .jar file using this code:
It won’t unzip, only 20 / 500 files, and no folders/pictures
The same thing happens when I enter a .zip file in filename.
Any one any suggestions?

import zipfile
zfilename = "PhotoVieuwer.jar"
if zipfile.is_zipfile(zfilename):
    print "%s is a valid zip file" % zfilename
else:
    print "%s is not a valid zip file" % zfilename
print '-'*40

zfile = zipfile.ZipFile( zfilename, "r" )

zfile.printdir()
print '-'*40

for info in zfile.infolist():
    fname = info.filename

    data = zfile.read(fname)


    if fname.endswith(".txt"):
        print "These are the contents of %s:" % fname
        print data


    filename = fname
    fout = open(filename, "w")
    fout.write(data)
    fout.close()
    print "New file created --> %s" % filename
    print '-'*40

But, it doesn’t work, it unzips maybe 10 out of 500 files
Can anyone help me on fixing this?

Already Thanks!

I tried adding, what Python told me, I got this:
Oops! Your edit couldn’t be submitted because:

body is limited to 30000 characters; you entered 153562
and only the error is :

Traceback (most recent call last):
  File "C:\Python27\uc\TeStINGGFDSqAEZ.py", line 26, in <module>
    fout = open(filename, "w")
IOError: [Errno 2] No such file or directory: 'net/minecraft/client/ClientBrandRetriever.class'

The files that get unzipped:

amw.Class
amx.Class
amz.Class
ana.Class
ane.Class
anf.Class
ang.Class
ank.Class
anm.Class
ann.Class
ano.Class
anq.Class
anr.Class
anx.Class
any.Class
anz.Class
aob.Class
aoc.Class
aod.Class
aoe.Class
  • 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-06-09T05:42:34+00:00Added an answer on June 9, 2026 at 5:42 am

    This traceback tells you what you need to know:

    Traceback (most recent call last):
      File "C:\Python27\uc\TeStINGGFDSqAEZ.py", line 26, in <module>
        fout = open(filename, "w")
    IOError: [Errno 2] No such file or directory: 'net/minecraft/client/ClientBrandRetriever.class'
    

    The error message says that either the file ClientBrandRetriever.class doesn’t exist or the directory net/minecraft/client does not exist. When a file is opened for writing Python creates it, so it can’t be a problem that the file does not exist. It must be the case that the directory does not exist.

    Consider that this works

    >>> open('temp.txt', 'w') 
    <open file 'temp.txt', mode 'w' at 0x015FF0D0>
    

    but this doesn’t, giving nearly identical traceback to the one you are getting:

    >>> open('bogus/temp.txt', 'w')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: 'bogus/temp.txt'
    

    Creating the directory fixes it:

    >>> os.makedirs('bogus')
    >>> open('bogus/temp.txt', 'w')
    <open file 'bogus/temp.txt', mode 'w' at 0x01625D30>
    

    Just prior to opening the file you should check if the directory exists and create it if necessary.

    So to solve your problem, replace this

    fout = open(filename, 'w')
    

    with this

    head, tail = os.path.split(filename) # isolate directory name
    if not os.path.exists(head):         # see if it exists
        os.makedirs(head)                # if not, create it
    fout = open(filename, 'w')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is

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.