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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:30:34+00:00 2026-06-16T15:30:34+00:00

Erm, I have ready-to-use code, and I’m sure it really works, but I get

  • 0

Erm, I have ready-to-use code, and I’m sure it really works, but I get the following error:

TypeError: descriptor ‘split’ requires a ‘str’ object but received a
‘unicode’

That’s the whole def:

def assemblePacket(self, type):
    ipSplit = str.split(self.serverVars[0], '.')

    packet = 'SAMP'
    packet += chr(int(ipSplit[0]))
    packet += chr(int(ipSplit[1]))
    packet += chr(int(ipSplit[2]))
    packet += chr(int(ipSplit[3]))
    packet += chr(self.serverVars[1] & 0xFF)
    packet += chr(self.serverVars[1] >> 8 & 0xFF)
    packet += type

    return packet

And here is the problem:

ipSplit = str.split(self.serverVars[0], '.')

I’m sure it’s not because of the code, I’ve tried it before (the same script) and it worked. No idea why it doesn’t now.And this “unicode” makes me think I have to change “str.split”, but hmmm. Waiting for opinions 🙂

  • 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-16T15:30:36+00:00Added an answer on June 16, 2026 at 3:30 pm

    The problem is that str.split is a method of the str class, but is being called for an object of the unicode class. Call the method directly with ipSplit = self.serverVars[0].split('.') to have it work for anything (including str and unicode) with a split method.

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

Sidebar

Related Questions

Erm... what the title says really; I have a PHP script executed by an
I am comparing two strings using following code string1.Contains(string2) but i am not getting
Ok so I have this storedproc in my SQL 2008 database (works in 2005
Consider the following code snippet: list<someClass>& method(); .... list<someClass> test = method(); What will
One thing I have noticed on some sites is that they use one BIIIIIIIG
I need to abstract some behavioural code and have a problem trying to reference
I'm pretty certain I'm missing something really obvious here but this seems quite bizarre.
I have the following problem that I need to express. There are persons, workplaces
I have the following DB model: **Person table** ID | Name | StateId ------------------------------
i have a problem with a mysql ERM which is currently driving me crazy.

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.