Error in trytond startup

I have a freshly installed openSUSE leap 15.01 installation.

The distribution contained triton 4.6 which installed cleanly and ran (server & client)

On 09/02/19 I uninstalled those packages and with pip installed the current release.

trytond would not start. After a little investigation I made a change to the code and now the server is running.

I have looked into bug report area and have decided I am not yet qualified to be in that arena, but I do want to bring this to the attention of the appropriate party if this change needs to be noted and propagated.

This is the log file errors on startup:

Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: File “”, line 219, in _call_with_frames_removed
Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: File “/usr/lib/python3.6/site-packages/trytond/modules/party/init.py”, line 6, in
Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: from . import party <=========================================================
Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: File “/usr/lib/python3.6/site-packages/trytond/modules/party/party.py”, line 3, in
Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: from stdnum import get_cc_module <============================================
Sep 06 07:27:54 bills-big-lt-02.test.lcl trytond[20090]: ImportError: cannot import name ‘get_cc_module’

This is the first 7 lines of party.py before and after my change from my notes

Here is a section of the file before I edit it:

        1 # This file is part of Tryton.  The COPYRIGHT file at the top level of
        2 # this repository contains the full copyright notices and license terms.
        3 from stdnum import get_cc_module
        4 import stdnum.exceptions
        5 from sql import Null, Column, Literal
        6 from sql.functions import CharLength, Substring, Position
        7 

And this is the file after I edit it. The line I changed is indicated.

        1 # This file is part of Tryton.  The COPYRIGHT file at the top level of
        2 # this repository contains the full copyright notices and license terms.
        3 from stdnum.util import get_cc_module <==================================
        4 import stdnum.exceptions
        5 from sql import Null, Column, Literal
        6 from sql.functions import CharLength, Substring, Position
        7 

With this change and a reboot, trytond is now running.

Please pass this along if you think it useful.

Indeed we require python-stdnum >= 1.8 since 5.2.
I filled Issue 8646: stdnum >= 1.8 is required - Tryton issue tracker to declare it in setup.py.

I am sorry if I did not make myself clear. (or maybe I am mistaken).

In my opinion, the error comes from the form of the call for get_cc_mudule in party.py

Here is the output of a little script I wrote which searches for strings. The script reports the date and time the script was run, the string searched for, and upon finding specified string, it reports the file name the specified string is found in and the line numbers the specified string is found on.

There were 4 files with hits.

    1  20190907_060230 
     2  looking for get_cc_module (excluding message log & netscape caches)
       
     3  #################################### 
     4  /usr/lib/python3.6/site-packages/trytond/modules/party/party.py 
     5  3:from stdnum import get_cc_module <=======================================
     6  460:                    module = get_cc_module(*type.split('_', 1))
     7  474:            module = get_cc_module(*self.type.split('_', 1))
     8  489:            module = get_cc_module(*self.type.split('_', 1))
     9  537:                eu_vat = get_cc_module('eu', 'vat') 
       
    10  #################################### 
    11  /usr/lib/python3.6/site-packages/stdnum/iban.py 
    12  52:from stdnum.util import clean, get_cc_module <++++++++++++++++++++++++++++++
    13  91:def _get_cc_module(cc):
    14  96:        _country_modules[cc] = get_cc_module(cc, 'iban')
    15  114:        module = _get_cc_module(number[:2])
    16  132:    module = _get_cc_module(number[:2]) 
       
    17  #################################### 
    18  /usr/lib/python3.6/site-packages/stdnum/eu/vat.py 
    19  43:from stdnum.util import clean, get_cc_module, get_soap_client  <+++++++++++++++++++
    20  63:def _get_cc_module(cc):
    21  72:        _country_modules[cc] = get_cc_module(cc, 'vat')
    22  80:    module = _get_cc_module(number[:2])
    23  90:    module = _get_cc_module(number[:2])
    24  112:            if _get_cc_module(cc).is_valid(number)] 
       
    25  #################################### 
    26  /usr/lib/python3.6/site-packages/stdnum/util.py 
    27  27:>>> get_cc_module('nl', 'vat').__name__
    28  29:>>> get_cc_module('is', 'vat').__name__
    29  169:def get_cc_module(cc, name): <=======================================

The pointing lines were added by me after the fact.

The problem revealed to me by this was that get_cc_module was requested to load 3 times.

2 of the times the form was “stdnum.util imput get_cc_module”

The line causing the error was in the form “stdnum import get_cc_module”

The error was an improper path. Making the path in the first instance look just like the paths in the other two instances cleared up the problem (from what I have been able to see so far). And at least trytond is now running.

No, the error comes from that you have a too old python-stdnum version installed. You need at least 1.8.

Thanks, I will look into that.