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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:35:59+00:00 2026-05-25T22:35:59+00:00

I am having a unicode problem and, as everytime I have something related I’m

  • 0

I am having a unicode problem and, as everytime I have something related I’m completely lost..

One of my Django template renders a TypeError :

Exception Value:    

coercing to Unicode: need string or buffer, long found

The line giving trouble is just a string ( which I want to use in a mysql query) :

query = unicode('''(SELECT asset_name, asset_description, asset_id, etat_id, etat_name FROM Asset LEFT OUTER JOIN Etat ON etat_id_asset=asset_id WHERE asset_id_proj='''+proj+''' AND asset_id_type='''+t.type_id+''' ORDER BY asset_name, asset_description) UNION (SELECT asset_name, asset_description, asset_id, 'NULL', 'NULL' FROM Asset WHERE asset_id_proj='''+proj+''' AND asset_id_type='''+t.type_id+''' AND asset_id IN (SELECT etat_id_asset FROM Etat)); ''')

What can be wrong here ?

  • 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-25T22:36:00+00:00Added an answer on May 25, 2026 at 10:36 pm

    I know you figured out a better way to accomplish, but to answer the original question, in case you get that error again somewhere else in the project:

    t.type_id appears to be a long integer. You cannot mix integers in strings unless you convert to string, this is really simple:

    myString = 'some string with type id ' + str(t.type_id) + ', and whatever else you want in the string.'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a heckuva time with this one, though I feel I'm missing something obvious.
I'm having the following problem with 2 MySQL tables that have a relation: I
i have a json file with unicode characters, and i'm having trouble to parse
I'm having some problem with getting Python to handle my unicode text correctly. I've
I am having a slight problem. I want a django app that can upload
I'm having a problem emailing unicode characters using smtplib in Python 3. This fails
I'm having a problem regarding Unicode in Python. I can print the output fine
I know I'm having a problem with a conversion from Unicode but I'm not
I started learning Django recently and am having a strange problem with the tutorial.
I am having a problem with my encoding in Python. I have tried different

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.