Error on reading the AlbumData.xml

26 views
Skip to first unread message

Moritz

unread,
Mar 12, 2011, 10:53:32 AM3/12/11
to phoshare-users
Hi,

I get the following error when starting phoshare 1.4.5 and 1.4.4:

Reading iPhoto database from /Users/moritz/Pictures/iPhoto Library...
Albumid 6161 and RollDateAsTimerIntervall is None AlbumName is Film 51
Error: float() argument must be a string or a number

Traceback (most recent call last):
File "/Users/moritz/Desktop/Phoshare.app/Contents/Resources/lib/
python2.7/phoshare/phoshare_ui.py", line 888, in export_thread
File "/Users/moritz/Desktop/Phoshare.app/Contents/Resources/lib/
python2.7/appledata/iphotodata.py", line 552, in get_iphoto_data
File "/Users/moritz/Desktop/Phoshare.app/Contents/Resources/lib/
python2.7/appledata/iphotodata.py", line 108, in __init__
File "/Users/moritz/Desktop/Phoshare.app/Contents/Resources/lib/
python2.7/appledata/iphotodata.py", line 459, in __init__
File "/Users/moritz/Desktop/Phoshare.app/Contents/Resources/lib/
python2.7/appledata/applexml.py", line 30, in getappletime
TypeError: float() argument must be a string or a number


Please note that I inserted a print statement for debbugging (the
output: "Albumid 6161 and RollDateAsTimerIntervall is None AlbumName
is Film 51") in iphotodata.py which causes the line numbers above of
to be misleading (all > 457 must be -1).

However, I have iPhoto 6.0.6 (German version) and I already tried to
repair the xml file with the help of iPhoto. After that I basically
got the same error on another roll.

The roll which caused the above error looks like this in AlbumData.xml
(I hope I got the important stuff):

<dict>
<key>AlbumId</key>
<integer>6161</integer>
<key>AlbumName</key>
<string>Film 51</string>
<key>Parent</key>
<integer>999000</integer>
<key>KeyList</key>
<array>
<string>6162</string>
<string>6164</string>
<string>6166</string>
<string>6168</string>
<string>6170</string>
<string>6172</string>
<string>6174</string>
<string>6176</string>
<string>6178</string>
<string>6180</string>
<string>6182</string>
<string>6184</string>
<string>6186</string>
<string>6188</string>
<string>6190</string>
<string>6194</string>
<string>6198</string>
</array>
<key>Album Type</key>
<string>Regular</string>
<key>PhotoCount</key>
<integer>17</integer>
</dict>

Maybe somebody has an idea what causes the problem and how it can be
resolved.

Bye
Moritz

Tilman Sporkert

unread,
Mar 12, 2011, 1:39:54 PM3/12/11
to phoshar...@googlegroups.com
Moritz,
thanks for the detailed information, that makes debugging this quite easy. I guess iPhoto 6.0.6 didn't write some of the timestamps into the AlbumData.xml file. That's easy to fix. At line 29 of appledata/applexml.py, add these two lines:
if not value:
return None
to make it look like this:

def getappletime(value):
'''Converts a numeric Apple time stamp into a date and time'''
if not value: # Add
return None # Add
try:
return datetime.datetime.fromtimestamp(APPLE_BASE + float(value))
except ValueError, _e:
# bad time stamp in database, default to "now"
return datetime.datetime.now()

For a normal export, Phoshare doesn't actually need the date of an album, so this should be fine.

Tilman

Moritz Siuts

unread,
Mar 13, 2011, 8:58:33 AM3/13/11
to phoshar...@googlegroups.com
Thanks Tilman, your patch works perfect!
Phoshare is a really nice tool.
Reply all
Reply to author
Forward
0 new messages