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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:28:10+00:00 2026-05-29T18:28:10+00:00

I am passing a query id object to a view, which then fetches the

  • 0

I am passing a query id object to a view, which then fetches the object and then calls the following func:

def portAdmin(self,status):

    status = status
    self.adminStateDict = {
                        'activate':      tuple([tuple([1,3,6,1,2,1,2,2,1,7,self.snmpPortOID]),rfc1902.Integer32(1)]),
                        'deactivate' : tuple([tuple([1,3,6,1,2,1,2,2,1,7,self.snmpPortOID]),rfc1902.Integer32(2)]),
                        }
    (errorIn, activateErrorStatus, errorIndex, varBinds) = cmdgen.CommandGenerator().setCmd(
                                                cmdgen.CommunityData('my-agent', '.xxxx', 0),
                                                cmdgen.UdpTransportTarget((self.snmpIp, 161)),
                                                self.adminStateDict[status]
                                                )

But without returning from the function, I get this error when I request the page:

    Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 283, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 68, in __call__
    return self.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 169, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 59, in technical_500_response
    html = reporter.get_traceback_html()
  File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 117, in get_traceback_html
    frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']]
  File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 34, in _dec
    args[0] = force_unicode(args[0])
  File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 93, in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 51: invalid start byte. You passed in 'MibTableColumn((1, 3, 6, 1, 6, 3, 18, 1, 1, 1, 4), \x80\x00O\xb8\x05\xc0\xa8\x06 \x0c\r)' (<type 'str'>)

But when I call the same function in a django shell, this works fine. I am stumped.
What I want to know is why:
1. it works in the shell and not on the web-server.
2. how do I make it work on the web-server with Django/WSGI.

Thanks.

  • 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-29T18:28:12+00:00Added an answer on May 29, 2026 at 6:28 pm

    Because the system default local for Apache is often ASCII, whereas in your user account it is UTF-8.

    You either fix the code so as not to rely on implicit coercion, which will use the system default encoding for the process, or you override Apache init environment so as to set LANG to a UTF-8 variant.

    Try googling for ‘Apache UTF-8 locale’ and find the appropriate way of doing it for your Apache distro.

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

Sidebar

Related Questions

hello friends following is my query where displaylist is object if stringBuilder which have
I'm passing query string parameter to .aspx page with 'Ñ' character in value. But
Passing in an Expression to a Linq query behaves differently depending on syntax used,
What I want to do is while executing MySQL query, passing column data into
I have been using LINQ with compiled queries, basically passing into the compiled query
I have (yet another) powershell query. I have an array in powershell which i
I trying to pass a DateTime object as a query string parameter to a
i want to apply Zend_Filter_StripTags on object array $my_result = $obj->listdata(calling select query from
Im having problems displaying records to my view when passing viewdata to a user
I've used answer from this question: Django: making raw SQL query, passing multiple/repeated params?

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.