I decided to post this on dev list because I am dealing with in-depth 
aspects of tryton source code. Please correct me if i am wrong.

I get a strange error when running a simple proteus script:

---
from proteus import config

config.set_trytond(database='test', 
config_file='/home/mr/training/trytond.conf')
---

When I run this script, I get this error:

---
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    config.set_trytond(database='test', 
config_file='/home/mr/training/trytond.conf')
  File 
"/home/mr/training/venv/local/lib/python2.7/site-packages/proteus/config.py", 
line 280, in set_trytond
    _CONFIG.current = TrytondConfig(database, user, config_file=config_file)
  File 
"/home/mr/training/venv/local/lib/python2.7/site-packages/proteus/config.py", 
line 232, in __init__
    self.pool.init()
  File "/home/mr/training/trytond/trytond/pool.py", line 155, in init
    lang=lang)
  File "/home/mr/training/trytond/trytond/modules/__init__.py", line 426, 
in load_modules
    with Transaction().start(database_name, 0):
  File "/home/mr/training/trytond/trytond/transaction.py", line 75, in start
    Database = backend.get('Database')
  File "/home/mr/training/trytond/trytond/backend/__init__.py", line 35, in 
get
    module = sys.modules[modname]
KeyError: 'trytond.backend.'
---

Indeed, in file /home/mr/training/trytond/trytond/backend/__init__.py there 
is a get function with the line 'module = sys.modules[modname]', but there 
is something strange. When I inserted a debugging print command in  get 
method, the text is printed four times when I start trytond, but when I run 
the script, nothing is printed.

On the other hand, when debugging print command is "print modname", output 
(when starting the server) is 'trytond.backend.sqlite', but in traceback 
key is 'trytond.backend.', i.e the third component is and empty string.

Then I modified the code and put in the string literal 
'trytond.backend.sqlite', i.e

old line:
module = sys.modules[modname]

new line:
module = sys.modules['trytond.backend.sqlite']

However, i again get error: KeyError: 'trytond.backend.sqlite'

I thought this is the correct value and don't understand why this key 
doesn't exist in sys.modules dictionary.

And finally, i discovered the problem is solved when inserted this line in 
trytond configuration file, in database section:

uri = sqlite://

According to documentation, this is the default, so again something 
confusing.

Please help me understand what is going on.

Regards,
Marko

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/4e636520-c2d2-47e0-ac18-33a755bb3e85%40googlegroups.com.

Reply via email to