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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:28:26+00:00 2026-05-22T01:28:26+00:00

I get the error: UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xa0 in position 7338:

  • 0

I get the error: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 7338: ordinal not in range(128)" once I try to run the program after I freeze my script with cx_freeze. If I run the Python 3 script normally it runs fine, but only after I freeze it and try to run the executable does it give me this error. I would post my code, but I don’t know exactly what parts to post so if there are any certain parts that will help just let me know and I will post them, otherwise it seems like I have had this problem once before and solved it, but it has been a while and I can’t remember what exactly the problem was or how I fixed it so any help or pointers to get me going in the right direction will help greatly. Thanks in advance.

  • 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-22T01:28:27+00:00Added an answer on May 22, 2026 at 1:28 am

    Tell us exactly which version of Python on what platform.

    Show the full traceback that you get when the error happens. Look at it yourself. What is the last line of your code that appears? What do you think is the bytes string that is being decoded? Why is the ascii codec being used??

    Note that automatic conversion of bytes to str with a default codec (e.g. ascii) is NOT done by Python 3.x. So either you are doing it explicitly or cx_freeze is.

    Update after further info in comments.

    Excel does not save csv files in ASCII. It saves them in what MS calls “the ANSI codepage”, which varies by locale. If you don’t know what yours is, it is probably cp1252. To check, do this:

    >>> import locale; print(locale.getpreferredencoding())
    cp1252
    

    If Excel did save files in ASCII, your offending '\xa0' byte would have been replaced by ‘?’ and you would not be getting a UnicodeDecodeError.

    Saving your files in UTF-8 would need you to open your files with encoding='utf8' and would have the same problem (except that you’d get a grumble about 0xc2 instead of 0xa0).

    You don’t need to post all four of your csv files on the web. Just run this little script (untested):

    import sys
    for filename in sys.argv[1:]:
        for lino, line in enumerate(open(filename), 1):
            if '\xa0' in line:
                print(ascii(filename), lino, ascii(line))
    

    The '\xa0' is a NO-BREAK SPACE aka   … you may want to edit your files to change these to ordinary spaces.

    Probably you will need to ask on the cx_freeze mailing list to get an answer to why this error is happening. They will want to know the full traceback. Get some practice — show it here.

    By the way, “offset 7338” is rather large — do you expect lines that long in your csv file? Perhaps something is reading all of your file …

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

Sidebar

Related Questions

I get this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 4:
Suppose I type line = line.decode('gb18030;) and get the error UnicodeDecodeError: 'gb18030' codec can't
I constantly get this error using mako: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0'
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I have this query and I get error Operand should contain 1 column(s), whats
What is the best way to get error messages from a WF4 workflow back
In our application we've run into an error numerous times where we get error
I use the following jquery statements but i get error in this function onGetDataSuccess(result)
I am using following PHP code for trigger creation but always get error, please
When we try to create a view within a funcion we get ERROR: there

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.