nqzhang / google-blog-converters-appengine

Automatically exported from code.google.com/p/google-blog-converters-appengine
Apache License 2.0
0 stars 0 forks source link

"AttributeError: 'int' object has no attribute 'decode'" #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. ./livejournal2blogger.sh -u float_dublin -p ***

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "./../src/livejournal2blogger/lj2b.py", line 472, in <module>
    translator.Translate(sys.stdout)
  File "./../src/livejournal2blogger/lj2b.py", line 206, in Translate
    outfile.write(str(feed))
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 334, in __str__
    return self.ToString()
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 331, in ToString
    return ElementTree.tostring(self._ToElementTree(),
encoding=string_encoding)
  File "./../src/livejournal2blogger/lj2b.py", line 61, in _ToElementTree
    tree = gdata.GDataFeed._ToElementTree(self)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 326, in _ToElementTree
    self._AddMembersToElementTree(new_tree)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 286, in _AddMembersToElementTree
    instance._BecomeChildElement(tree)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 314, in _BecomeChildElement
    self._AddMembersToElementTree(new_child)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 288, in _AddMembersToElementTree
    member._BecomeChildElement(tree)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 314, in _BecomeChildElement
    self._AddMembersToElementTree(new_child)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 299, in _AddMembersToElementTree
    ExtensionContainer._AddMembersToElementTree(self, tree)
  File
"/home/float-dublin/Desktop/google-blog-converters-appengine-read-only/lib/atom/
__init__.py",
line 185, in _AddMembersToElementTree
    tree.text = self.text.decode(MEMBER_STRING_ENCODING)
AttributeError: 'int' object has no attribute 'decode'

What version of the product are you using? On what operating system?
ubuntu hardy
Linux hvan 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/Linux
Python 2.5.2

Tried trunk
Repository Root: http://google-blog-converters-appengine.googlecode.com
Revision: 62

Please provide any additional information below.

Original issue reported on code.google.com by Kostya.H...@gmail.com on 15 Jan 2009 at 6:33

GoogleCodeExporter commented 8 years ago
That looks like duplicate of the second part of issue #14
Though, I have seen "long" instead of "int".

Original comment by mathemonkey on 15 Jan 2009 at 6:39

GoogleCodeExporter commented 8 years ago
> I have seen "long" instead of "int".
it may depend on python version, i have 2.5.2

Original comment by Kostya.H...@gmail.com on 15 Jan 2009 at 6:54

GoogleCodeExporter commented 8 years ago
I had 
«54308428790203478762340052723346983453487023489987231275412390872348475» as
subject of the post, so I it did not fit into `int'.
Maybe I should try «42», I assume it fits into `int'.

$ python
Python 2.5.2 (r252:60911, Oct 28 2008, 15:30:26) 
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
>>> 
type(int('5430842879020347876234005272334698345348702348998723127541239087234847
5'))
<type 'long'>
>>> type(int('42'))
<type 'int'>

Original comment by mathemonkey on 15 Jan 2009 at 7:33

GoogleCodeExporter commented 8 years ago
Hi there.

I've added r63 which does the appropriate conversions from X to a string value 
before
adding it to the Blogger GData object.  The subject, body, and tags may be 
returned
from the LiveJournal XML-RPC call as integers or longs, as you have discovered.

Please give r63 a try and let me know if it fixes your errors. 

Original comment by jlu...@gmail.com on 15 Jan 2009 at 7:42

GoogleCodeExporter commented 8 years ago
script printed xml after few minutes, no unhandled exceptions. looks like issue 
was
fixed. 

Original comment by Kostya.H...@gmail.com on 16 Jan 2009 at 7:29

GoogleCodeExporter commented 8 years ago

Original comment by jlu...@gmail.com on 18 Jan 2009 at 9:30