I used to import Trytond using below code, It always worked fine
without any error.
But since version 1.7 and now 1.8 , New error message has been shown.
This is the error message in python code:
===========================================================
File "/home/mohammad/.pycrust/startup", line 13, in <module>
from trytond.tools import Cache
ImportError: cannot import name Cache
And here is the script which is being used by me in PyCrust .
===========================================================
import sys, os
sys.path.append('/home/mohammad/workspace/tryton-dist/trytond1.6/
trytond/')
import logging
logging.basicConfig(level=logging.FATAL)
from trytond.config import CONFIG
CONFIG.load()
from trytond.modules import register_classes
from trytond.pool import Pool
from trytond.backend import Database
from trytond.tools import Cache
# Register classes populates the pool of models:
register_classes()
# dbname contains the db you want to use
DBNAME = 'mohammad_test'
# Instantiate the database and the pool
DB = Database(DBNAME).connect()
POOL = Pool(DBNAME)
POOL.init()
# Get a cursor on the database
cursor = DB.cursor()
# Clean the global cache for multi-instance
Cache.clean(DBNAME)
# User 0 is root user. We use it to get the admin id:
user_obj = POOL.get('res.user')
user = user_obj.search(cursor, 0, [
('login', '=', 'admin'),
], limit=1)[0]
print "the admin id is: " + str(user)
===================================================
does anybody have an idea about that ?
--
[email protected] mailing list