Discussion:
[BitPim-devel] FileCache does not seem to work
d***@netzero.com
2005-01-21 19:36:40 UTC
Permalink
Roger, common.FileCache class does not seem to work. First, there was the problem of 'os' not being imported, but even with that fixed, there were addtional exceptions which I'm attaching FYI.

-Joe Pham

def statinfo(filename):
"""Returns a simplified version of os.stat results that can be used to tell if a file
has changed. The normal structure returned also has things like last access time
which should not be used to tell if a file has changed."""
try:
import os
s=os.stat(filename) <-- Line 553
return (s.st_mode, s.st_ino, s.st_dev, s.st_uid, s.st_gid, s.st_size, s.st_mtime,
s.st_ctime)
except:
raise
return None


An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
File "E:\Python23\Lib\site-packages\wx\_core.py", line 10673, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\gui.py", line 886, in OnPopulateEverythingFromDisk
self.wallpaperwidget.populate(results)
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\wallpaper.py", line 290, in populate
self.OnRefresh()
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\guiwidgets.py", line 1110, in OnRefresh
self.aggdisp.UpdateItems()
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\aggregatedisplay.py", line 372, in UpdateItems
self.sections=self.datasource.GetSections()
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\wallpaper.py", line 128, in GetSections
items=[DisplayItem(self, key, self.mainwindow.wallpaperpath) for key in self._data['wallpaper-index']]
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\guiwidgets.py", line 1293, in __init__
self.setvals()
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\guiwidgets.py", line 1301, in setvals
self.fileinfo=self.view.GetFileInfo(self.filename)
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\wallpaper.py", line 274, in GetFileInfo
return fileinfo.identify_imagefile(filename)
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\fileinfo.py", line 284, in identify_imagefile
return thefileinfocache.set(file,ImgFileInfo(fo))
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\common.py", line 583, in set
self.items[filename]=statinfo(filename),value
File "E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\common.py", line 553, in statinfo
s=os.stat(filename)
TypeError: coercing to Unicode: need string or buffer, type found

Variables by last 8 frames, innermost last

Frame UpdateItems in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\aggregatedisplay.py at line 372
self = <aggregatedisplay.Display; proxy of C++ wxScrolledWindow instance at _40d74401_p

Frame GetSections in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\wallpaper.py at line 128
_[1] = <built-in method append of list object at 0x01978CF0>
self = <wallpaper.WallpaperView; proxy of C++ wxPanel instance at _f088da01_p_wxPanel>
key = 0

Frame __init__ in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\guiwidgets.py at line 1293
mediapath = u'E:\\Documents and Settings\\Joe\\My Documents\\bitpim\\wallpaper'
self = <wallpaper.DisplayItem object at 0x01DDD4F0>
key = 0
view = <wallpaper.WallpaperView; proxy of C++ wxPanel instance at _f088da01_p_wxPanel>

Frame setvals in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\guiwidgets.py at line 1301
me = Keys ['name', 'origin']
{'origin': 'builtin', 'name': 'Clock1'}
self = <wallpaper.DisplayItem object at 0x01DDD4F0>

Frame GetFileInfo in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\wallpaper.py at line 274
self = <wallpaper.WallpaperView; proxy of C++ wxPanel instance at _f088da01_p_wxPanel>
filename = u'E:\\Documents and Settings\\Joe\\My Documents\\bitpim\\wallpaper\\Clock1'

Frame identify_imagefile in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\fileinfo.py at line 284
v = None
obj = None
filename = u'E:\\Documents and Settings\\Joe\\My Documents\\bitpim\\wallpaper\\Clock1'
f = <function idimg_PNG at 0x01A220B0>
fo = <fileinfo.FailedFile instance at 0x01E868A0>

Frame set in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\common.py at line 583
self = <common.FileCache instance at 0x01A217B0>
value = <fileinfo.ImgFileInfo instance at 0x01E868F0>
filename = <type 'file'>

Frame statinfo in E:\Documents and Settings\Joe\My Documents\cell_apps\bitpim\common.py at line 557
filename = <type 'file'>


______________________________________________________________________
Speed up your surfing with NetZero HiSpeed.
Now includes pop-up blocker!
Only $14.95/month -visit http://www.netzero.com/surf to sign up today!
Roger Binns
2005-01-22 05:51:43 UTC
Permalink
Post by d***@netzero.com
Roger, common.FileCache class does not seem to work.
Good catch. Sadly it failed safe so I didn't notice
and all it does is increase memory consumption in order
to decrease CPU consumption.

The second bug was just using the wrong variable name
and would only happen for unidentified image formats.
(BTW if you need yet another format to work on, we
really should have GIF in fileinfo).

Roger
d***@netzero.com
2005-01-22 08:51:24 UTC
Permalink
all it does is increase memory consumption in order to decrease CPU >
consumption.
The only thing I noticed is that since it always responses with a cache hit, the ringtone sizes were not being updated correctly (when I was trying to adjust the crop that affects the size).
we really should have GIF in fileinfo
I'll give it a try, off-hand, do you know any site that provides gif file format info?

-Joe Pham



______________________________________________________________________
Speed up your surfing with NetZero HiSpeed.
Now includes pop-up blocker!
Only $14.95/month -visit http://www.netzero.com/surf to sign up today!
Roger Binns
2005-01-22 16:51:33 UTC
Permalink
Post by d***@netzero.com
The only thing I noticed is that since it always responses with
a cache hit, the ringtone sizes were not being updated correctly
(when I was trying to adjust the crop that affects the size).
Actually it was always responding with a cache miss. I think there
is a seperate bug causing the ringtones to not refresh.
Post by d***@netzero.com
I'll give it a try, off-hand, do you know any site that provides gif file format info?
http://www.w3.org/Graphics/GIF/spec-gif87.txt
http://256.com/gray/docs/gifspecs/data.html

You'll want to make sure that both GIF87 and the tweaks in GIF89a
are understood.

Roger

Loading...