H
Hugh Macdonald
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...
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...