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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:31:26+00:00 2026-05-26T02:31:26+00:00

In the following I use translate() to eliminate punctuation from a string. I’ve been

  • 0

In the following I use translate() to eliminate punctuation from a string. I’ve been having a lot of problems with translate because it does not work with unicode. But now I noticed that the script works well in the development server but raises an error in the production server.

The request is sent by chrome extension to google app engine. Any suggestions how I can fix this so that the same script works in production server? Or is there another way of eliminating the punctuation without using translate().

Logs in the production server:

2011-10-11 06:18:10.384
get_rid_of_unicode: ajax: how to use xmlhttprequest
E 2011-10-11 06:18:10.384
expected a character buffer object
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
    handler.post(*groups)
  File "/base/data/home/apps/ting-1/1.353888928453510037/ting.py", line 2073, in post
    user_tag_list_case = f1.striplist(main().split(" "))
  File "/base/data/home/apps/ting-1/1.353888928453510037/ting.py", line 2055, in main
    title_no_punctuation = get_rid_of_unicode.translate(None, string.punctuation)
TypeError: expected a character buffer object

Same script works with no problem in the development server:

INFO 2011-10-11 13:15:49,154 ting.py:2052] get_rid_of_unicode: how to use xmlhttprequest  
INFO 2011-10-11 13:15:49,154 ting.py:2057] title_no_punctuation: how to use xmlhttprequest

The script:

def main():

    title_lowercase = title.lower()
    title_without_possessives = remove_possessive(title_lowercase)
    title_without_double_quotes = remove_double_quotes(title_without_possessives)
    get_rid_of_unicode = title_without_double_quotes.encode('utf-8')
    title_no_punctuation = get_rid_of_unicode.translate(None, string.punctuation)
    back_to_unicode = unicode(title_no_punctuation, "utf-8")
    clean_title = remove_stop_words(back_to_unicode, f1.stop_words)
    return clean_title

user_tag_list = []
user_tag_list_case = f1.striplist(main().split(" "))
for tag in user_tag_list_case:
    user_tag_list.append(tag.lower())
  • 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-26T02:31:27+00:00Added an answer on May 26, 2026 at 2:31 am

    Google App Engine runs Python 2.5.2. str.translate() requires a 256-character string as the first argument; None has only been an allowed value since Python 2.6.

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

Sidebar

Related Questions

I have the following use case , lot of code which was tightly coupled
I am trying to use Google Translate REST API and while requesting the following
i use customfiel php code inside one of my views to translate a string
I am just beginning to use Django, and I am having problems. I would
I use the following method to retrieve something from a webservice using a HTTPWebRequest:
How do I translate the following to instead use PrototypeJS Event.observe? <input type=text ....
I'm trying to translate the following macro from land of lisp into clojure: (defmacro
I need to translate the following code to C# from php. What libraries /
Consider the following use of template template parameters... #include <iostream> template <typename X> class
I have the following use case, a struct with some boolean and int variables

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.