I'm hitting a painful error in a Django command I have written, which is parsing a set of data. The script parses the data, builds the ORM object, and tries to save it. When saving, I get the following error - AttributeError: 'Cursor' object has no attribute '_last_executed' My database is set to utf-8
Doing a bunch of research online trying to solve this did not yield much help. The closest I found was this Error: Cursor' object has no attribute '_last_executed
Where a 'fix' was to call unicode() on my strings. Which worked, until I had strings with apostrophes, such as u'aunt\u2019s' - then things quickly fall over.
So the above leads me to believe the initial cursor issue is something weird with encodings. I dont understand encodings enough to really understand the issue.
I've tried playing with the encode, decode calls manually, but no luck.
How should I go about solving this problem? It seems to be a mix of a Django bug and understanding encodings.
Some code snippets that may help
c=urllib2.urlopen(page_url)
soup=BeautifulSoup(c.read())
my_string = soup.find('title')['content']
my_ormObj = Foo()
foo.title = my_string
foo.save()
The above snippet is the kind of flow I'm using, and in some cases yields the error listed above. I try to take my_string and change it, and it gives the issues I listed in my third paragraph.