Discussion:
rrasyncmanager.py unicode error
Fernando Toledo
2009-10-29 16:08:44 UTC
Permalink
i have this error when i make a directory/file with special characters
(ñáéíóú) like "muñeca","Día", "Mis Imágenes" and these files/dirs dont syncing
with the phone:

2009-08-01 23:38:07,783 DEBUG FileProcessor : unpacking data - name
Trabajo/pdf/SAMBA_3_using_Windows_AD_Howto.pdf
2009-08-01 23:38:25,809 INFO FileDB : rescanning local files
/usr/lib/python2.5/site-packages/SyncEngine/rrasyncmanager.py:164:
UnicodeWarning: Unicode equal comparison failed to convert both arguments to
Unicode - interpreting them as being unequal
if self.db[fe].name == name:
2009-08-01 23:38:25,855 DEBUG FileDB : marking oid 2181038768 for remote
deletion
2009-08-01 23:38:25,858 DEBUG FileProcessor : deleting object 2181038768 from
handheld
2009-08-01 23:38:25,888 DEBUG RRAThread : Object reader for item index 0
Exception exceptions.UnicodeDecodeError: UnicodeDecodeError('ascii', 'Mis
Im\xc3\xa1genes', 6, 7, 'ordinal not in range(128)') in
'pyrra._CB_ReaderCallback' ignored
[rra_syncmgr_put_multiple_objects:1144] Empty object of type 00002713 with ID
00000000, ignoring.
2009-08-01 23:38:46,060 INFO FileDB : rescanning local files
2009-08-01 23:39:06,096 INFO FileDB : rescanning local files
2009-08-01 23:39:26,131 INFO FileDB : rescanning local files
2009-08-01 23:39:46,166 INFO FileDB : rescanning local files
2009-08-01 23:40:06,193 INFO FileDB : rescanning local files

i fix it decode to utf8 adding a line in that function ( in
rrasyncmanager.py):

def _ScanItemDB(self,prefix,syncpath,items,isDir):

for item in items:
tfpath = os.path.join(syncpath,item)
mtime = os.path.getmtime(tfpath)
tfpath = tfpath[len(prefix)+1:]

----> tfpath = tfpath.decode("utf-8")

oid = self._NameInDB(tfpath)
if oid == None:
self.dbnew.append(FileDBEntry(tfpath,mtime,LOCAL_STATE_NEW,isDir))
else:
self.db[oid].scanFlag = 1

# skip the mtime checks on dirs - otherwise we will get all sorts
# of grief as the dir mtime is updated when the contents are.

if mtime != self.db[oid].mtime and not isDir:
self.logger.debug("mtime changed on %s" % self.db[oid].name)
self.db[oid].mtime = mtime
self.db[oid].localstate = LOCAL_STATE_MODIFIED
else:
self.db[oid].localstate = LOCAL_STATE_UNCHANGED

i know that is not the better fix and i dont know why it work, but work for
me.
what is the better way to fix it?
in running synce on debian testing/unstable

$ dpkg -l|grep rapi2
ii librapi2 0.13.1-2 Make RAPI calls to a Windows Mobile device,
ii python-rapi2 0.13.1-2 Make RAPI calls to a Windows Mobile device,

$ dpkg -l|grep synce
ii libsynce0 0.13-2 Helper library to sync Windows Mobile device
ii opensync-plugin-synce 0.13-2 SynCE plugin for OpenSync
ii synce-hal 0.13.1-3 Daemon to maintain a connection to Windows M
ii synce-kpm 0.13-2 KDE device manager for Windows Mobile device
ii synce-sync-engine 0.13-2 Synchronization engine for Windows Mobile de
--
Dock Sud BBS
http://bbs.docksud.com.ar
telnet://bbs.docksud.com.ar
Mark Ellis
2009-11-10 19:20:24 UTC
Permalink
Post by Fernando Toledo
i have this error when i make a directory/file with special characters
(ñáéíóú) like "muñeca","Día", "Mis Imágenes" and these files/dirs dont syncing
Hi Fernando, sorry for not responding sooner. Would you mind opening a
bug report in sourceforge about this. It obviously needs looking at, and
yours looks like a good solution, we'll have to get around to it at some
point.

Thanks
Mark
Post by Fernando Toledo
2009-08-01 23:38:07,783 DEBUG FileProcessor : unpacking data - name
Trabajo/pdf/SAMBA_3_using_Windows_AD_Howto.pdf
2009-08-01 23:38:25,809 INFO FileDB : rescanning local files
UnicodeWarning: Unicode equal comparison failed to convert both arguments to
Unicode - interpreting them as being unequal
2009-08-01 23:38:25,855 DEBUG FileDB : marking oid 2181038768 for remote
deletion
2009-08-01 23:38:25,858 DEBUG FileProcessor : deleting object 2181038768 from
handheld
2009-08-01 23:38:25,888 DEBUG RRAThread : Object reader for item index 0
Exception exceptions.UnicodeDecodeError: UnicodeDecodeError('ascii', 'Mis
Im\xc3\xa1genes', 6, 7, 'ordinal not in range(128)') in
'pyrra._CB_ReaderCallback' ignored
[rra_syncmgr_put_multiple_objects:1144] Empty object of type 00002713 with ID
00000000, ignoring.
2009-08-01 23:38:46,060 INFO FileDB : rescanning local files
2009-08-01 23:39:06,096 INFO FileDB : rescanning local files
2009-08-01 23:39:26,131 INFO FileDB : rescanning local files
2009-08-01 23:39:46,166 INFO FileDB : rescanning local files
2009-08-01 23:40:06,193 INFO FileDB : rescanning local files
i fix it decode to utf8 adding a line in that function ( in
tfpath = os.path.join(syncpath,item)
mtime = os.path.getmtime(tfpath)
tfpath = tfpath[len(prefix)+1:]
----> tfpath = tfpath.decode("utf-8")
oid = self._NameInDB(tfpath)
self.dbnew.append(FileDBEntry(tfpath,mtime,LOCAL_STATE_NEW,isDir))
self.db[oid].scanFlag = 1
# skip the mtime checks on dirs - otherwise we will get all sorts
# of grief as the dir mtime is updated when the contents are.
self.logger.debug("mtime changed on %s" % self.db[oid].name)
self.db[oid].mtime = mtime
self.db[oid].localstate = LOCAL_STATE_MODIFIED
self.db[oid].localstate = LOCAL_STATE_UNCHANGED
i know that is not the better fix and i dont know why it work, but work for
me.
what is the better way to fix it?
in running synce on debian testing/unstable
$ dpkg -l|grep rapi2
ii librapi2 0.13.1-2 Make RAPI calls to a Windows Mobile device,
ii python-rapi2 0.13.1-2 Make RAPI calls to a Windows Mobile device,
$ dpkg -l|grep synce
ii libsynce0 0.13-2 Helper library to sync Windows Mobile device
ii opensync-plugin-synce 0.13-2 SynCE plugin for OpenSync
ii synce-hal 0.13.1-3 Daemon to maintain a connection to Windows M
ii synce-kpm 0.13-2 KDE device manager for Windows Mobile device
ii synce-sync-engine 0.13-2 Synchronization engine for Windows Mobile de
Loading...