[Qgis-user] Error on loading python with simple quote in translation

2008-11-13 Thread Lionel Roubeyrie
Hi all,
A syntax error occurs when loading python if the translation file
contains simples quotes.
I solved the problem by removing the simple quote in the translation
file, but the best thing would be to change qgis_except_hook_msg
definition to support simples quotes.
Here is the error (QGIS 1.0.0 preview2 on Intrepid) :

def qgis_except_hook_msg(type, value, tb, msg):
  lst = traceback.format_exception(type, value, tb)
  if msg == None: msg = 'Une erreur est apparue sur l'exécution du code
python : '
  txt = ''+msg+'

'
  for s in lst:
txt += s
  txt += '
Version de Python :
' + sys.version + '

'
  txt += 'Chemin vers Python :' + str(sys.path)
  txt = txt.replace('\n', '
')
  txt = txt.replace('  ', '  ')
  
  msg = QgsMessageOutput.createMessageOutput()
  msg.setTitle('Erreur Python')
  msg.setMessage(txt, QgsMessageOutput.MessageHtml)
  msg.showMessage()


  File , line 3
if msg == None: msg = 'Une erreur est apparue sur l'exécution du
code python : '
  ^
SyntaxError: invalid syntax


My 2 cents

-- 
Lionel Roubeyrie
chargé d'études
LIMAIR - La Surveillance de l'Air en Limousin
http://www.limair.asso.fr


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Error on loading python with simple quote in translation

2008-11-13 Thread Martin Dobias
On Thu, Nov 13, 2008 at 10:54 AM, Lionel Roubeyrie
[EMAIL PROTECTED] wrote:
 Hi all,
 A syntax error occurs when loading python if the translation file
 contains simples quotes.
 I solved the problem by removing the simple quote in the translation
 file, but the best thing would be to change qgis_except_hook_msg
 definition to support simples quotes.

Hi Lionel,

you're right! For now you can work around this by inserting backslash
before simple quote: \'
I'll fix that so in final 1.0 release it will be escaped automatically.

Regards
Martin
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user