Ticket #863 (closed defect: fixed)

Opened 3 years ago

Last modified 1 year ago

Cryptic error message for configuration syntax error

Reported by: max Assigned to: Fuzzyman
Priority: normal Milestone: 1.0b1
Component: TurboGears Version: 0.9a6
Severity: normal Keywords:
Cc: ischenko@gmail.com

Description

Adding line like "kid.encoding = latin1" (note missing quotes over latin1) yields the following cryptic traceback:

Traceback (most recent call last):
  File "D:\Projects\z01\start-z01.py", line 21, in ?
    modulename="z01.config")
  File "d:\projects\3rd-party\turbogears-1.0\turbogears\config.py", line 183, in update_config
    configdata2 = ConfigObj(configfile, unrepr=True)
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 1055, in __init__
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 1323, in _parse
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 1491, in _handle_value
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 203, in unrepr
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 157, in build
  File "C:\Python24\lib\site-packages\configobj-4.3.0-py2.4.egg\configobj.py", line 184, in build_Name
configobj.UnknownType: Undefined Name

TurboGears should be more user-friendly here, at least explaining there was a syntax error and at best giving exact error location.

Change History

05/15/06 15:00:56 changed by fuzzyman@voidspace.org.uk

  • owner changed from anonymous to fuzzyman@voidspace.org.uk.

This is a ConfigObj? issue, and will be addressed.

I *should* be able to add a line number. What would you prefer the error message to say ? (Given that in unrepr mode, ConfigObj? is expecting a valid Python expression.)

Fuzzyman

05/15/06 15:01:20 changed by anonymous

  • owner changed from fuzzyman@voidspace.org.uk to Fuzzyman.

05/21/06 15:17:14 changed by Fuzzyman

This should be fixed in ConfigObj? 4.3.2 (now in subversion)

See :

http://www.voidspace.org.uk/python/weblog/arch_d7_2006_05_20.shtml#e336

Fuzzyman

05/23/06 23:20:00 changed by max

  • cc set to ischenko@gmail.com.

OK, but I cannot verify it until 4.3.2 can be installed with easy_install.

05/31/06 02:44:05 changed by jorge.vargas

  • version changed from 0.9a5 to 0.9a6.

a diferent issue but a cryptic error too

Traceback (most recent call last):

File "/usr/local/bin/tg-admin", line 7, in ?

sys.exit(

File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py", line 274, in main

command = command.load()(turbogears.version)

File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py", line 101, in init

self.find_config()

File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py", line 66, in find_config

load_project_config(self.config)

File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py", line 54, in load_project_config

modulename = package + ".config")

File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/config.py", line 183, in update_config

configdata2 = ConfigObj?(configfile, unrepr=True)

File "/usr/lib/python2.4/site-packages/ConfigObj-4.3.1-py2.4.egg/configobj.py", line 1077, in init

configobj.ConfigObjError?: Parsing failed.

this happens when you have 2 keys inside the same section with the same name, which will become a common problem ones people start not seeing the default uncommented sqlobject.dburi in dev.cfg

08/01/06 11:05:36 changed by fuzzyman

  • status changed from new to closed.
  • resolution set to fixed.

All these issues *should* have been addressed by ConfigObj? 4.3.2.

Once this is included in Turbogears, this ticket can be closed. Further issues should be raised in a new ticket.