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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:04:19+00:00 2026-06-11T09:04:19+00:00

My scripting is python and cassandra is data stax community edition. TypeError: A str

  • 0

My scripting is python and cassandra is data stax community edition.

TypeError: A str or unicode value was expected, but int was received instead (3902503)

this is the error I’m getting while trying to insert into a cassandra column family.

the code is like:

for x in feed:
    cf.insert(uuid.uuid4(), x)

x is a simple array in the form of “{key:value}”

The error log suggests:

    Traceback (most recent call last):
      File "C:\Users\me\Desktop\pro1\src\pro1.py", line 73, in <module>
        str("swf"): str("aws")
      File "c:\Python27\lib\site-packages\pycassa\columnfamily.py", line 969, in insert
        mut_list = self._make_mutation_list(columns, timestamp, ttl)
      File "c:\Python27\lib\site-packages\pycassa\columnfamily.py", line 504, in _make_mutation_list
        columns.iteritems())
      File "c:\Python27\lib\site-packages\pycassa\columnfamily.py", line 503, in <lambda>
        return map(lambda (c, v): Mutation(self._make_cosc(_pack_name(c), _pack_value(v, c), timestamp, ttl)),
      File "c:\Python27\lib\site-packages\pycassa\columnfamily.py", line 462, in _pack_value
        return packer(value)
      File "c:\Python27\lib\site-packages\pycassa\marshal.py", line 231, in pack_bytes
        % (v.__class__.__name__, str(v)))
    TypeError: A str or unicode value was expected, but int was received instead (3902503)        

There seems to be something very minute I’m missing here… well thats why I came here to ask experts!

  • 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-11T09:04:20+00:00Added an answer on June 11, 2026 at 9:04 am

    Make sure your values match your column family type. It appears your column family either is a BytesType or has no type associated with it, so pycassa will only accept string values. You can map all your values to str with a list comprehension with a nested dict comprehension (the latter requires python 2.7 and up):

    cf.insert(uuid.uuid4(), [{k: str(v) for k, v in d.iteritems()} for d in x])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can use python and other scripting languages in android. But I
Preferably using a scripting language like Perl or Python, but if I have to
I'm trying to learn the python scripting . Being some body who started coding
I've been using Textmate for Ruby/Python scripting for awhile and now have a need
I've just started learning about Gimp scripting using Python, and was wondering, how do
When I speak of scripting languages I am speaking of languages like Python, Perl,
If you have to choose a scripting language, why would you choose Python?
I am wondering if there are any statically typed, embeddable scripting languages. Python, JavaScript,
The Scripting.FileSystemObject TextStream object supports Windows style Unicode and 'plain text' modified by the
i am learning python.. i want to do certain kind of scripting in python..

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.