Discussion:
[Bitpim-devel] Sanyo testers needed
Stephen Wood
2004-10-06 09:59:56 UTC
Permalink
I would like a few Sanyo owners who are able to run BitPim out of CVS to
test a change I just made. The change involves OS dependent code, but I
am able to test it only with Linux, so I would like it tested with
Windows or Mac.

The change is that PNG Images being written to the phone are now
converted to an 8 bit color map just before being sent. This conversion
involves the use of 3 external binaries, which are included with
BitPim. With this change, one should be able to import a graphic in the
Wallpaper pane and then send it to a Sanyo phone, and not receive the
famous Error 109 or similar.

Thanks, Stephen
Jim Smith
2004-10-06 12:32:26 UTC
Permalink
Assuming the CVS code had time to get updated before I did a check out a few
minutes ago, I got the included exception. This is with a Sanyo PM-8200 on
Windows 2000 SP4. The file was a 10K JPG which was imported into BitPim as a
32K PNG.

This may or may not be related. Because the imported file becomes too big
for the phone, I have tried converting some JPG's to PNG myself with
IrfanView. When I imported the 13K PNG file into the release version of
BitPim, it grew to 31K, and of course wouldn't download to the phone.

Jim

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

Traceback (most recent call last):
File "D:\Projects\BitPim\gui.py", line 150, in run
res=call()
File "D:\Projects\BitPim\gui.py", line 90, in __call__
return apply(self.method, self.args+args, d)
File "D:\Projects\BitPim\gui.py", line 1160, in senddata
apply(func, args)
File "D:\Projects\BitPim\gui.py", line 1167, in writewallpaper
return self.commphone.savewallpapers(data, merge)
File "D:\Projects\BitPim\com_sanyo.py", line 785, in savewallpapers
return self.savemedia('wallpapers', 'wallpaper-index', 'images',
results, merge)
File "D:\Projects\BitPim\com_sanyo.py", line 853, in savemedia
content = self.convertto8bitpng(content)
File "D:\Projects\BitPim\com_sanyo.py", line 109, in convertto8bitpng
f.write(pngdata)
IOError: (0, 'Error')

Variables by last 8 frames, innermost last

Frame __bootstrap in D:\Python23\lib\threading.py at line 436
self = <WorkerThread(BitPim helper, started daemon)>

Frame run in D:\Projects\BitPim\gui.py at line 143
e = <exceptions.IOError instance at 0x02211850>
res = None
self = <WorkerThread(BitPim helper, started daemon)>
item = (<gui.Request instance at 0x022118F0>, <gui.Callback
instance at 0x022117D8>)
call = <gui.Request instance at 0x022118F0>
ex = <exceptions.IOError instance at 0x02211850>
resultcb = <gui.Callback instance at 0x022117D8>
first = 0

Frame __call__ in D:\Projects\BitPim\gui.py at line 90
self = <gui.Request instance at 0x022118F0>
args = ()
d = Keys []
{}
kwargs = Keys []
{}

Frame senddata in D:\Projects\BitPim\gui.py at line 1160
count = 0
self = <WorkerThread(BitPim helper, started daemon)>
args = [{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jp
xx = (<bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, start
dict = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg
func = <bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, starte
todo = [(<bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, star
desc = 'Wallpaper'

Frame writewallpaper in D:\Projects\BitPim\gui.py at line 1167
merge = True
self = <WorkerThread(BitPim helper, started daemon)>
data = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg

Frame savewallpapers in D:\Projects\BitPim\com_sanyo.py at line 785
merge = True
self = <com_sanyo8200.Phone instance at 0x022114E0>
results = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg

Frame savemedia in D:\Projects\BitPim\com_sanyo.py at line 853
key = -1
index = Keys [-1]
{-1: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x
errors = False
name = u'sung lee.png'
idx = -1
mediaindexkey = 'wallpaper-index'
mediakey = 'wallpapers'
k = 2015
results = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg
efile = u'sung lee.png'
mediatype = 'images'
content =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
merge = True
init = Keys ['images']
{'images': {-1: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x0
wpi = Keys [2013, 2015, 2020, 2022, 2024, 2097, 2099, 2101,
2103, 2105, 3000]
{2020: {'origin': 'images', 'name': 'Fenwick Light
House.jpg'}, 2022: {'origin':
w = 0
wp = Keys [0]
{0: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x9
data =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
self = <com_sanyo8200.Phone instance at 0x022114E0>

Frame convertto8bitpng in D:\Projects\BitPim\com_sanyo.py at line 109
ncolortry = 256
f = <open file
'D:\Projects\BitPim\helpers\pngtopnm.exe>c:\docume~1\jamesr~1.smi\loc
ncolor = 256
self = <com_sanyo8200.Phone instance at 0x022114E0>
helpersdirectory = 'D:\\Projects\\BitPim\\helpers'
pngdata =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
p = 'D:\\Projects\\BitPim'
ncolormax = 257
pnm =
'c:\\docume~1\\jamesr~1.smi\\locals~1\\temp\\tmpohpnbr.pnm'
pnmtopngbin = 'D:\\Projects\\BitPim\\helpers\\pnmtopng.exe'
ppmquantbin = 'D:\\Projects\\BitPim\\helpers\\ppmquant.exe'
size = 31991
ncolormin = 1
osext = '.exe'
pngtopnmbin = 'D:\\Projects\\BitPim\\helpers\\pngtopnm.exe'
Stephen Wood
2004-10-06 13:29:52 UTC
Permalink
Jim:

Thanks for trying things so quickly!
Post by Jim Smith
Assuming the CVS code had time to get updated before I did a check out a few
minutes ago, I got the included exception. This is with a Sanyo PM-8200 on
Windows 2000 SP4. The file was a 10K JPG which was imported into BitPim as a
32K PNG.
I waited for the CVS to update, so you have the correct version.
Post by Jim Smith
This may or may not be related. Because the imported file becomes too big
for the phone, I have tried converting some JPG's to PNG myself with
IrfanView. When I imported the 13K PNG file into the release version of
BitPim, it grew to 31K, and of course wouldn't download to the phone.
With the old wxPython, you could help BitPim by doing that trick, but
with the new wxPython, just about any graphic ends up over 16K. About
the only trick you can do (until I get this hack to work) is to quit
BitPim, replace the imported file with a smaller one in the BitPim
data directory and then send it to the phone.
Post by Jim Smith
p = 'D:\\Projects\\BitPim'
ncolormax = 257
pnm =
'c:\\docume~1\\jamesr~1.smi\\locals~1\\temp\\tmpohpnbr.pnm'
pnmtopngbin = 'D:\\Projects\\BitPim\\helpers\\pnmtopng.exe'
ppmquantbin = 'D:\\Projects\\BitPim\\helpers\\ppmquant.exe'
size = 31991
ncolormin = 1
osext = '.exe'
pngtopnmbin = 'D:\\Projects\\BitPim\\helpers\\pngtopnm.exe'
Can you check if those three exe programs exist in that location. There
should also be several dll's in the helpers directory. I assume that
D:\Projects\BitPim is the root location of where your copy of BitPim is.

I guess I'll have to update wxPython on my XP machine and do some
debugging myself!


Stephen
Jim Smith
2004-10-06 14:08:07 UTC
Permalink
Post by Stephen Wood
With the old wxPython, you could help BitPim by doing that trick, but
with the new wxPython, just about any graphic ends up over 16K. About
the only trick you can do (until I get this hack to work) is to quit
BitPim, replace the imported file with a smaller one in the BitPim
data directory and then send it to the phone.
Cool, I'll try that.
Post by Stephen Wood
Can you check if those three exe programs exist in that location. There
should also be several dll's in the helpers directory. I assume that
D:\Projects\BitPim is the root location of where your copy of BitPim is.
Yes, the files are there. Here's the directory listing:

Directory of D:\Projects\BitPim\helpers

10/06/2004 07:08a <DIR> .
10/06/2004 07:08a <DIR> ..
08/06/2004 12:44a 10 .cvsignore
10/06/2004 07:08a 3,267 ffmpeg.exe
10/04/2004 11:53p 156,672 libnetpbm10.dll
10/04/2004 11:53p 206,627 libpng12.dll
10/04/2004 11:53p 25,088 pngtopnm.exe
10/04/2004 11:53p 710,290 pngtopnm.lbin
10/04/2004 11:53p 207,340 pngtopnm.mbin
10/04/2004 11:53p 33,792 pnmtopng.exe
10/04/2004 11:53p 696,483 pnmtopng.lbin
10/04/2004 11:53p 211,412 pnmtopng.mbin
10/04/2004 11:53p 21,504 ppmquant.exe
10/04/2004 11:53p 571,751 ppmquant.lbin
10/04/2004 11:53p 66,280 ppmquant.mbin
10/04/2004 11:53p 70,656 zlib1.dll
14 File(s) 2,981,172 bytes
Stephen Wood
2004-10-07 17:35:43 UTC
Permalink
Jim & anyone who wants to test out writing images to Sanyo phones:

I updated the code that reduces image file size before sending to Sanyo
phones, so that it will hopefully work on Windows. I can't actually
test the code myself until this evening, but if anyone wants to try it,
I would appreciate it. The public CVS is up to date.

The routine that does the conversion to smaller file size is
convertto8bitpng. It has been moved from com_sanyo.py, to
conversions.py.

Stephen
Jim Smith
2004-10-07 19:27:51 UTC
Permalink
Stephen,
Sorry, I got the following exception this time.
Jim

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

Traceback (most recent call last):
File "D:\Projects\BitPim\gui.py", line 150, in run
res=call()
File "D:\Projects\BitPim\gui.py", line 90, in __call__
return apply(self.method, self.args+args, d)
File "D:\Projects\BitPim\gui.py", line 1160, in senddata
apply(func, args)
File "D:\Projects\BitPim\gui.py", line 1167, in writewallpaper
return self.commphone.savewallpapers(data, merge)
File "D:\Projects\BitPim\com_sanyo.py", line 726, in savewallpapers
return self.savemedia('wallpapers', 'wallpaper-index', 'images',
results, merge)
File "D:\Projects\BitPim\com_sanyo.py", line 794, in savemedia
content = conversions.convertto8bitpng(content,16383)
File "D:\Projects\BitPim\conversions.py", line 67, in convertto8bitpng
f.open(png,"rb")
AttributeError: 'file' object has no attribute 'open'

Variables by last 8 frames, innermost last

Frame __bootstrap in D:\Python23\lib\threading.py at line 436
self = <WorkerThread(BitPim helper, started daemon)>

Frame run in D:\Projects\BitPim\gui.py at line 143
e = <exceptions.AttributeError instance at 0x022353C8>
res = None
self = <WorkerThread(BitPim helper, started daemon)>
item = (<gui.Request instance at 0x02235238>, <gui.Callback
instance at 0x022352B0>)
call = <gui.Request instance at 0x02235238>
ex = <exceptions.AttributeError instance at 0x022353C8>
resultcb = <gui.Callback instance at 0x022352B0>
first = 0

Frame __call__ in D:\Projects\BitPim\gui.py at line 90
self = <gui.Request instance at 0x02235238>
args = ()
d = Keys []
{}
kwargs = Keys []
{}

Frame senddata in D:\Projects\BitPim\gui.py at line 1160
count = 0
self = <WorkerThread(BitPim helper, started daemon)>
args = [{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jp
xx = (<bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, start
dict = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg
func = <bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, starte
todo = [(<bound method WorkerThread.writewallpaper of
<WorkerThread(BitPim helper, star
desc = 'Wallpaper'

Frame writewallpaper in D:\Projects\BitPim\gui.py at line 1167
merge = True
self = <WorkerThread(BitPim helper, started daemon)>
data = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg

Frame savewallpapers in D:\Projects\BitPim\com_sanyo.py at line 726
merge = True
self = <com_sanyo8200.Phone instance at 0x0222BD00>
results = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg

Frame savemedia in D:\Projects\BitPim\com_sanyo.py at line 794
key = -1
index = Keys [-1]
{-1: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x
errors = False
name = u'sung lee kay.png'
idx = -1
mediaindexkey = 'wallpaper-index'
mediakey = 'wallpapers'
k = 2015
results = Keys ['ringtone-index', 'uniqueserial',
'wallpaper-index', 'wallpapers']
{'wallpaper-index': {2020: {'origin': 'images', 'name':
'Fenwick Light House.jpg
efile = u'sung lee kay.png'
mediatype = 'images'
content =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
merge = True
init = Keys ['images']
{'images': {-1: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x0
wpi = Keys [2013, 2015, 2020, 2022, 2024, 2097, 2099, 2101,
2103, 2105, 3000]
{2020: {'origin': 'images', 'name': 'Fenwick Light
House.jpg'}, 2022: {'origin':
w = 0
wp = Keys [0]
{0: {'data':
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x9
data =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
self = <com_sanyo8200.Phone instance at 0x0222BD00>

Frame convertto8bitpng in D:\Projects\BitPim\conversions.py at line 67
size = 34562
pngdata =
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x84\x00\x00\x00\x90\x08\x06
\x00
pnmtopngbin = 'D:\\Projects\\BitPim\\helpers\\pnmtopng.exe'
f = <closed file
'c:\docume~1\jamesr~1.smi\locals~1\temp\tmp8vjwpl.png', mode 'wb' a
ncolor = 256
helpersdirectory = 'D:\\Projects\\BitPim\\helpers'
maxsize = 16383
p = 'D:\\Projects\\BitPim'
ncolormax = 257
pnm =
'c:\\docume~1\\jamesr~1.smi\\locals~1\\temp\\tmpfkf1of.pnm'
osext = '.exe'
ppmquantbin = 'D:\\Projects\\BitPim\\helpers\\ppmquant.exe'
ncolortry = 256
ncolormin = 1
png =
'c:\\docume~1\\jamesr~1.smi\\locals~1\\temp\\tmp8vjwpl.png'
pngtopnmbin = 'D:\\Projects\\BitPim\\helpers\\pngtopnm.exe'

Loading...