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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:43:51+00:00 2026-06-18T02:43:51+00:00

I have a little script which shall extract a .zip-file. This works well, but

  • 0

I have a little script which shall extract a .zip-file.
This works well, but only for .zip-files which doesn’t contain files with letters like “ä”, “ö”, “ü” (and so on) in their filenames.
Otherwise I get this error:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyc", line 552, in __bootstrap_inner
  File "install.py", line 92, in run
  File "zipfile.pyc", line 962, in extractall
  File "zipfile.pyc", line 950, in extract
  File "zipfile.pyc", line 979, in _extract_member
  File "ntpath.pyc", line 108, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0x94 in position 32: ordinal not in range(128)

Here is the extracting part of my script:

zip = zipfile.ZipFile(path1)
zip.extractall(path2)

How can I solve this?

  • 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-18T02:43:53+00:00Added an answer on June 18, 2026 at 2:43 am

    one suggestion:

    I get the error when I do that:

    >>> c = chr(129)
    >>> c + u'2'
    
    Traceback (most recent call last):
      File "<pyshell#21>", line 1, in <module>
        c + u'2'
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 0: ordinal not in range(128)
    

    There is a unicode string passed to join somewhere.

    Could it be the file path of the zipfile is encoded in unicode?
    What if you do this:

    zip = zipfile.ZipFile(str(path1))
    zip.extractall(str(path2))
    

    or this:

    zip = zipfile.ZipFile(unicode(path1))
    zip.extractall(unicode(path2))
    

    This is line 128 in ntpath:

    def join(a, *p): # 63
        for b in p: # 68
                    path += "\\" + b  # 128
    

    Second Suggestion:

    from ntpath import *
    
    def join(a, *p):
        """Join two or more pathname components, inserting "\\" as needed.
        If any component is an absolute path, all previous path components
        will be discarded."""
        path = a
        for b in p:
            b_wins = 0  # set to 1 iff b makes path irrelevant
            if path == "":
                b_wins = 1
    
            elif isabs(b):
                # This probably wipes out path so far.  However, it's more
                # complicated if path begins with a drive letter:
                #     1. join('c:', '/a') == 'c:/a'
                #     2. join('c:/', '/a') == 'c:/a'
                # But
                #     3. join('c:/a', '/b') == '/b'
                #     4. join('c:', 'd:/') = 'd:/'
                #     5. join('c:/', 'd:/') = 'd:/'
                if path[1:2] != ":" or b[1:2] == ":":
                    # Path doesn't start with a drive letter, or cases 4 and 5.
                    b_wins = 1
    
                # Else path has a drive letter, and b doesn't but is absolute.
                elif len(path) > 3 or (len(path) == 3 and
                                       path[-1] not in "/\\"):
                    # case 3
                    b_wins = 1
    
            if b_wins:
                path = b
            else:
                # Join, and ensure there's a separator.
                assert len(path) > 0
                if path[-1] in "/\\":
                    if b and b[0] in "/\\":
                        path += b[1:]
                    else:
                        path += b
                elif path[-1] == ":":
                    path += b
                elif b:
                    if b[0] in "/\\":
                        path += b
                    else:
                        # !!! modify the next line so it works !!!
                        path += "\\" + b
                else:
                    # path is not empty and does not end with a backslash,
                    # but b is empty; since, e.g., split('a/') produces
                    # ('a', ''), it's best if join() adds a backslash in
                    # this case.
                    path += '\\'
    
        return path
    
    import ntpath
    ntpath.join = join
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've this little script which does it's job pretty well but sometimes it tends
A little background: I have a perl script which is performing a number of
I have this little script that shows one wisdom each day. so I have
This is a little tricky so bear with me: I have a PHP script
I have a little script which demonstrates my problem, here is javascript code of
I have a little Bash script which suspends the computer after a given number
I have a little script I wrote in python and it actually works on
I need a little script which allows me to do this: if(// window body
I have currently a DNS Reverse lookup script which works however there is a
I have a little script to run a search daemon, like: run.sh : cd

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.