rrasyncmanager.py unicode error

View: New views
2 Messages — Rating Filter:   Alert me  

rrasyncmanager.py unicode error

by Bugzilla from ftoledo@docksud.com.ar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@...
https://lists.sourceforge.net/lists/listinfo/synce-devel

signature.asc (205 bytes) Download Attachment

Re: rrasyncmanager.py unicode error

by Mark Ellis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-29 at 17:08 +0100, Fernando Toledo wrote:
> 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:
>

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

> 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
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@...
https://lists.sourceforge.net/lists/listinfo/synce-devel

signature.asc (204 bytes) Download Attachment