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

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Thu Nov 13 01:54:17 PST 2008


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





More information about the Qgis-user mailing list