i finally installed it and /prog/scrape doesn't work.
nice job, guido. wasn't the whole point of continuing 2.x supposed to be for backwards compatibility?
>>11
something about 8-bit bytestrings vs unicode strings.
i fixed it by changing db.execute('INSERT INTO posts (thread, id, author, email, trip, time, body) VALUES (?, ?, ?, ?, ?, ?, ?)', b) to db.execute('INSERT INTO posts (thread, id, author, email, trip, time, body) VALUES (?, ?, ?, ?, ?, ?, ?)', [unicode(str(i).encode('string_escape')) for i in b]).
>>12
That's really interesting, since it works with Python2.5 and if Python2.6 changed anything, it would (or should) have been to make Unicode behave more like it does in Py3k, where it's completely transparent.
Odd.
Name:
Anonymous2009-06-24 2:54
>>12
I thought change was only in python 3.x, would the 2to3 tool help?
>>15
That's like the worst of both worlds. Well done, Gweedo.
Name:
Anonymous2009-06-24 3:20
replacing db.execute('INSERT INTO threads VALUES (?, ?, ?)', (data[3], data[0], 0)) with db.execute('INSERT INTO threads VALUES (?, ?, ?)', (data[3], unicode(str(data[0]).encode('string_escape')), 0))
fixes the subjects.txt fail: bλcode<>Anonymous<><>1245343820<>40<>Anonymous<>1245511301 thing.
Name:
Anonymous2009-06-24 3:23
>>17
You know what else fixes that? Using Python2.5 like the hashbang tells you to.
Name:
Anonymous2009-06-24 9:14
"THE HASHBANG TOLD ME TO"
Name:
Anonymous2009-06-24 9:31
>>18
That hashbang is not the boss of me!
Anyway, there's a discussion of the problem over at http://code.djangoproject.com/ticket/7921 for those with an interest[who?].
Seems that passing byte strings wasn't very well defined, and passing wrongly encoded strings could prevent you from reading them out again, so the PySQLite guys put in a fix to catch the problem early.
Name:
Anonymous2009-06-24 9:34
ruby
Name:
Anonymous2009-06-24 10:58
>>21
The nice part about Python's dictionary syntax is that you can just pass a JSON string to eval and it'll return a proper dictionary.
Which is particularly useful since Python's json module was only added in Python2.6.
>>22
It's a little known fact, but /prog/ is actually entirely served from the zombie machines of people stupid enough to pass unsanitized input from third-party servers to eval.
If you're stuck on 2.5, simplejson is available from PyPi.
>>29
`string = """eval("__import__('os').getcwd()", {})"""`
Also have fun with ''.__class__.__base__.__base__.__subclasses__()`, I have '<type file>' 39th in the list.
Name:
Anonymous2009-06-25 6:59
why the fuck would you want to use this shitty ``program'' anyway?