Proteus

239 views
Skip to first unread message

Cato Nano

unread,
Jan 10, 2018, 11:59:20 AM1/10/18
to tryton
This

$ python
Python 2.7.14 (default, Sep 17 2017, 18:50:44)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from proteus import config, Model
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named proteus
>>>


Of course Proteus is installed with apt-get

This is more of a Debian/Python question than Tryton
Please bear with me

I'd like to use Proteus to debug one of my calculated fields, that's not working

Currently I have to reload the whole client and log in again every time I change something

Thanks

FREDY RAMIREZ

unread,
Jan 10, 2018, 12:36:53 PM1/10/18
to tryton
Hi,

You can download Proteus from tryton download page and set PYTHONPATH with your proteus path.

Hope this help.

Cédric Krier

unread,
Jan 10, 2018, 1:30:07 PM1/10/18
to tryton
On 2018-01-10 08:59, Cato Nano wrote:
> This
>
> $ python
> Python 2.7.14 (default, Sep 17 2017, 18:50:44)
> [GCC 7.2.0] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from proteus import config, Model
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named proteus
> >>>
>
>
> Of course Proteus is installed with apt-get

I guess you are not using the right Python for which proteus was
installed.
Maybe you are under a virtualenv, in this case you should install
proteus using `$ pip install proteus`.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Cato Nano

unread,
Jan 10, 2018, 2:52:08 PM1/10/18
to tryton
Il giorno mercoledì 10 gennaio 2018 19:30:07 UTC+1, Cédric Krier ha scritto:
> On 2018-01-10 08:59, Cato Nano wrote:
> > This
> >
> > $ python
> > Python 2.7.14 (default, Sep 17 2017, 18:50:44)
> > [GCC 7.2.0] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> from proteus import config, Model
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > ImportError: No module named proteus
> > >>>
> >
> >
> > Of course Proteus is installed with apt-get
>
> I guess you are not using the right Python for which proteus was
> installed.
> Maybe you are under a virtualenv, in this case you should install
> proteus using `$ pip install proteus`.
>
> --

Thank you people

No, I' m not using virtualenv.

But I found a couple of facts.

When called from within a python3 prompt, Proteus gets found

But this time xmlrpclib is missing

Also, xmlrpclib is not declared as a dependency in the Proteus setup.py file

I think I' ll take Fredy's suggestion, I'll build Proteus on my own and try to use that

Only, not right now.
Tomorrow
Thanks for your suggestions
Good night

Cédric Krier

unread,
Jan 10, 2018, 7:10:06 PM1/10/18
to tryton
On 2018-01-10 11:52, Cato Nano wrote:
> When called from within a python3 prompt, Proteus gets found
>
> But this time xmlrpclib is missing
>
> Also, xmlrpclib is not declared as a dependency in the Proteus setup.py file

xmlrpclib is a standard library of Python so it should not be declared
as dependency.
But indeed xmlrpclib is the name for Python2, in Python3 it should be
xmlrpc.
Normally, when installing proteus with Python3, the code is transformed
and xmlrpclib is changed for xmlrpc. So it seems the installation is
wrong. I guess it should be reported to the distribution you are using.

Cato Nano

unread,
Jan 11, 2018, 2:04:44 AM1/11/18
to tryton
Thank you Cedric

I already opened a thread with the Debian Tryton mantainers

I'll report to them your observation

Mathias Behrle

unread,
Jan 11, 2018, 7:39:00 AM1/11/18
to try...@googlegroups.com
* Cédric Krier: " Re: [tryton] Proteus" (Thu, 11 Jan 2018 01:07:32 +0100):

> On 2018-01-10 11:52, Cato Nano wrote:
> > When called from within a python3 prompt, Proteus gets found
> >
> > But this time xmlrpclib is missing
> >
> > Also, xmlrpclib is not declared as a dependency in the Proteus setup.py
> > file
>
> xmlrpclib is a standard library of Python so it should not be declared
> as dependency.
> But indeed xmlrpclib is the name for Python2, in Python3 it should be
> xmlrpc.
> Normally, when installing proteus with Python3, the code is transformed
> and xmlrpclib is changed for xmlrpc. So it seems the installation is
> wrong. I guess it should be reported to the distribution you are using.

Wrong guess.

JFTR: It was explained on the Debian mailing list to Cato Nano that he has to
take care himself for 2to3 conversion when not using distribution packages and
running instead from a downloaded package.

--

Mathias Behrle
MBSolutions
Gilgenmatten 10 A
D-79114 Freiburg

Tel: +49(761)471023
Fax: +49(761)4770816
http://www.m9s.biz
UStIdNr: DE 142009020
PGP/GnuPG key availabable from any keyserver, ID: 0xD6D09BE48405BBF6
AC29 7E5C 46B9 D0B6 1C71 7681 D6D0 9BE4 8405 BBF6

Cédric Krier

unread,
Jan 11, 2018, 9:00:06 AM1/11/18
to try...@googlegroups.com
On 2018-01-11 13:38, Mathias Behrle wrote:
> * Cédric Krier: " Re: [tryton] Proteus" (Thu, 11 Jan 2018 01:07:32 +0100):
>
> > On 2018-01-10 11:52, Cato Nano wrote:
> > > When called from within a python3 prompt, Proteus gets found
> > >
> > > But this time xmlrpclib is missing
> > >
> > > Also, xmlrpclib is not declared as a dependency in the Proteus setup.py
> > > file
> >
> > xmlrpclib is a standard library of Python so it should not be declared
> > as dependency.
> > But indeed xmlrpclib is the name for Python2, in Python3 it should be
> > xmlrpc.
> > Normally, when installing proteus with Python3, the code is transformed
> > and xmlrpclib is changed for xmlrpc. So it seems the installation is
> > wrong. I guess it should be reported to the distribution you are using.
>
> Wrong guess.
>
> JFTR: It was explained on the Debian mailing list to Cato Nano that he has to
> take care himself for 2to3 conversion when not using distribution packages and
> running instead from a downloaded package.

I do not see where it is a wrong guess. In previous email, Cato Nano
said: "Of course Proteus is installed with apt-get".
signature.asc

Cato Nano

unread,
Jan 11, 2018, 10:23:49 AM1/11/18
to tryton
I think Mathis is referring to my own Tryton module

He saw the path to my module in the stacktrace

Now I' m not sure I understand

Can't the Debian provided Proteus be used for developing your own Tryton modules?

Does it only work with Debian provided modules ?


Sergi Almacellas Abellana

unread,
Jan 11, 2018, 10:41:36 AM1/11/18
to try...@googlegroups.com
El 11/01/18 a les 16:23, Cato Nano ha escrit:
>
> I think Mathis is referring to my own Tryton module
>
> He saw the path to my module in the stacktrace
>
> Now I' m not sure I understand
>
> Can't the Debian provided Proteus be used for developing your own Tryton modules?
>
> Does it only work with Debian provided modules ?

As far as your module is importable from the debian python interpreter
it will work without problems.

How do you installed your module?

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Cato Nano

unread,
Jan 11, 2018, 2:30:36 PM1/11/18
to tryton
Sergi

thank you so much for your concern

I changed solution

I installed all with viertualenv and pip

For the server pip3, python3 and for the client pip2, python2 and a virtualenv that can access the pygtk provided by the local operating system (pygtk doesn' t install plainly so the one provided by the system is preferable)

I opened a python console and imported proteus a second ago and it works like a charm

I had stuck to the apt provided packages because I had assumed that they were reliable

I was wrong (to say at least)

Starting tomorrow I' ll try to debug my calculated field

Ugh !

Thank you so much to all of you for your help
Starting tomorrow I' ll try

Cato Nano

unread,
Jan 12, 2018, 12:29:26 PM1/12/18
to tryton
There was a local Proteus interfering with the Debian one

Sorry

Axel Braun

unread,
Jan 12, 2018, 12:34:20 PM1/12/18
to try...@googlegroups.com
Another good example why you should never mess up an installation from
distribution with an installation from source.

Cato Nano

unread,
Jan 12, 2018, 12:35:21 PM1/12/18
to tryton
Ok, now I' m at this (The database ":memory:" does not exist)

This is the pip3 based setup. Which component is missing ?

>>> config = config.set_trytond('sqlite:///:memory:')


Traceback (most recent call last):
File "<stdin>", line 1, in <module>

File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 274, in set_trytond
_CONFIG.current = TrytondConfig(database, user, config_file=config_file)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 230, in __init__
with Transaction().start(self.database_name, 0) as transaction:
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/transaction.py", line 88, in start
database = Database(database_name).connect()
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/backend/postgresql/database.py", line 96, in __new__
cursor_factory=LoggingCursor)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/psycopg2/pool.py", line 161, in __init__
self, minconn, maxconn, *args, **kwargs)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/psycopg2/pool.py", line 58, in __init__
self._connect()
File "/home/catonano/tributi/env/lib/python3.6/site-packages/psycopg2/pool.py", line 62, in _connect
conn = psycopg2.connect(*self._args, **self._kwargs)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATALE: il database ":memory:" non esiste


Axel Braun

unread,
Jan 12, 2018, 12:39:59 PM1/12/18
to try...@googlegroups.com
Am Freitag, 12. Januar 2018, 18:35:21 CET schrieb Cato Nano:
> Ok, now I' m at this (The database ":memory:" does not exist)

What does
psql -l
say?

Cédric Krier

unread,
Jan 12, 2018, 1:10:06 PM1/12/18
to tryton
You seem to have already imported trytond before running the
'set_trytond' so the previous import setup PostgreSQL as database
backend which does not have ':memory:' database.
Tryton can not change the backend during the run time, so it must be
set once at the beginning and not change during the execution.

Cato Nano

unread,
Jan 12, 2018, 2:23:19 PM1/12/18
to tryton
> Another good example why you should never mess up an installation from
> distribution with an installation from source.

Right

I had downloaded Proteus because I was _consideing_ to try to build and install it myself
But I never embarked in such a process. I never began

I just decomprrressed the tar.gz file there

I didn't expect that to interfere with the Debian supplied Proteus.

Rather, I'd say, because I was torred I overlooked the error message that was explicitly pointing to that decompressed folder, instead of a system provided one

So I bothered Mathias

Oh well :-/

Cato Nano

unread,
Jan 12, 2018, 2:28:01 PM1/12/18
to tryton
Thank you Cédric, I'll try tomorrow.

I tried these lines, in this order

>>> from proteus import config, Model, Wizard, Report
>>> config = config.set_trytond('sqlite:///:memory:')

because this is what I saw here

https://github.com/tryton/proteus

So I understand that I should run

>>> config = config.set_trytond('sqlite:///:memory:')

as a first step ?
I'll try

Cédric Krier

unread,
Jan 12, 2018, 5:15:07 PM1/12/18
to tryton
No this is correct. So maybe you have TRYTOND_CONFIG environment
variable set to a configuration file that configure postgresql as
backend.

Mathias Behrle

unread,
Jan 12, 2018, 7:13:16 PM1/12/18
to try...@googlegroups.com
* Cato Nano: " Re: [tryton] Proteus" (Fri, 12 Jan 2018 11:23:19 -0800 (PST)):

> So I bothered Mathias
>
> Oh well :-/

Not a problem, be welcome.

Have fun,
Mathias

Cato Nano

unread,
Jan 13, 2018, 2:16:12 AM1/13/18
to tryton
Good morning

Today the error message is different. Yesterday I probably messed up because I was tired, it happens

So here I am now

>>> from proteus import config, Model, Wizard, Report
>>> config = config.set_trytond('sqlite:///:memory:')
/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/modules/__init__.py:143: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
module_config.readfp(fp)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 274, in set_trytond
_CONFIG.current = TrytondConfig(database, user, config_file=config_file)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 228, in __init__
self.pool.init()
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/pool.py", line 153, in init
lang=lang, installdeps=installdeps)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/modules/__init__.py", line 461, in load_modules
with Transaction().start(database_name, 0):
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/transaction.py", line 106, in start
Cache.clean(database.name)
File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/cache.py", line 111, in clean
cursor.execute(*table.select(table.timestamp, table.name))
sqlite3.OperationalError: no such table: ir_cache
>>>

Cédric Krier

unread,
Jan 13, 2018, 4:00:08 AM1/13/18
to tryton
On 2018-01-12 23:16, Cato Nano wrote:
> Today the error message is different. Yesterday I probably messed up because I was tired, it happens
>
> So here I am now
>
> >>> from proteus import config, Model, Wizard, Report
> >>> config = config.set_trytond('sqlite:///:memory:')
> /home/catonano/tributi/env/lib/python3.6/site-packages/trytond/modules/__init__.py:143: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
> module_config.readfp(fp)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 274, in set_trytond
> _CONFIG.current = TrytondConfig(database, user, config_file=config_file)
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/proteus/config.py", line 228, in __init__
> self.pool.init()
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/pool.py", line 153, in init
> lang=lang, installdeps=installdeps)
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/modules/__init__.py", line 461, in load_modules
> with Transaction().start(database_name, 0):
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/transaction.py", line 106, in start
> Cache.clean(database.name)
> File "/home/catonano/tributi/env/lib/python3.6/site-packages/trytond/cache.py", line 111, in clean
> cursor.execute(*table.select(table.timestamp, table.name))
> sqlite3.OperationalError: no such table: ir_cache

Now you are connecting to a database that was not setup:
http://doc.tryton.org/4.6/trytond/doc/topics/setup_database.html#topics-setup-database

For memory database, you can use create_db from
trytond.tests.test_tryton like it is done for the test.
Indeed the README is not useful: https://bugs.tryton.org/issue7056

Cato Nano

unread,
Jan 18, 2018, 3:51:51 AM1/18/18
to tryton
I copied the test_tryton file in my project root, erased some stuff and left the create_db function

I get this

~/tributi/bridgehead2.py in create_db(name, lang)
51 None, 0, close=True, autocommit=True, _nocache=True) \
52 as transaction:
---> 53 transaction.database.create(transaction.connection, name)
54
55 with Transaction().start(name, 0, _nocache=True) as transaction,\

~/tributi/env/lib/python3.6/site-packages/trytond/backend/sqlite/database.py in create(cls, connection, database_name)
300 path = os.path.join(config.get('database', 'path'),
301 database_name + '.sqlite')
--> 302 with sqlite.connect(path) as conn:
303 cursor = conn.cursor()
304 cursor.close()

OperationalError: unable to open database file


I could use soem help about how to setup this db

Thanks

Cato Nano

unread,
Jan 21, 2018, 4:27:31 AM1/21/18
to tryton
ok I managed to get Proteus working

I figured out the passages of configuring and creating the database finally

Proteus is helping me less than I thought, though

Probably because I' d need more data to test properly

I' ll open a new thread
Reply all
Reply to author
Forward
0 new messages