473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Difference between str and string

I've been seeing some somewhat strange behaviour in a python script
that I'm writing and was wondering whether someone could help me out
here....

I have the following code:

path = getPath(bundle, item)
path = hub.parseString(path)

getPath is a function that returns a string, and hub.parseString is an
external C++ function that also returns a string..

When I run this at the moment, it gives:

TypeError: argument 1 must be string without null bytes, not str

However, if I add a print statement somewhere else in the code
completely (after this is executed, and printing out a different
variable altogether) it works (but only with some - it would only work
if I had both of the lines:

print "Details:"
print details

but it wouldn't work with just one...)
Anyway, any idea what I'm doing wrong or what python's doing wrong?

For the moment, I've got around this by doing:

path = hub.parseString((StringIO.StringIO(path)).getvalue ())

Which works, but I don't like doing it...

any suggestions would be most welcome...

--
Hugh Macdonald
Jul 18 '05 #1
1 4579
Hugh Macdonald wrote:
Anyway, any idea what I'm doing wrong or what python's doing wrong?


It looks you have a string with embedded null bytes, which is not
supported where you want to use it. Do

print repr(path)

to find out what precisely the value of path is (doing a plain print
would send the null bytes to the terminal, which might ignore them)

HTH,
Martin

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
17
by: Nathan Given | last post by:
Hello All, I am trying to debug a broken query. The query uses Left$(,4) instead of Left(,4). What is the difference between the Left() and Left$() functions in Microsoft Access? Thanks!...
12
by: Tee | last post by:
String Builder & String, what's the difference. and when to use which ? Thanks.
6
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What is the difference between a Field and a Property? Here is the context. In the VS.NET 2002 documentation, in the "String Members" section, we have the...
9
by: Anoj | last post by:
Hi All, is there any performance difference between + and & operator while concating string litrels. which one is better and why?? Thanx
7
by: Bart_D | last post by:
Hi, Can anybody explain me what's the difference between for example: imports system.data implements ICallbackEventHandler inherits System.Web.UI.Page Thanks Bart
7
by: Bruce One | last post by:
What is the difference between String and string in C#? What can u do with string that you cant do with String, vice versa?
6
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new...
6
by: =?Utf-8?B?SmVmZg==?= | last post by:
I thought this would already be covered here, but my search turned up nothing. In VS2005, if I use "String" to define a new variable/class, it colors it in the Aqua color as it does other...
45
by: anto frank | last post by:
hi friends, is ther any difference in array in c and array in c++?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.