# Tryton\_demo.py usage in Debian 10

**URL:** https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944
**Category:** User
**Created:** [November 13, 2019, 4:04pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944 "2019-11-13T16:04:52Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 13, 2019, 4:04pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/1 "2019-11-13T16:04:52Z")

</div>

I’ve got from [https://hg.tryton.org/tryton-tools/file/tip/tryton\_demo.py](https://hg.tryton.org/tryton-tools/file/tip/tryton_demo.py) to fill a demo database.  
Is there any “home page” for tryton\_demo.py ? Is it included in some stable package?

```
$ python tryton_demo.py --help
Traceback (most recent call last):
File "tryton_demo.py", line 4, in <module>
from dateutil.relativedelta import relativedelta
ImportError: No module named dateutil.relativedelta

```

(I have already tryton-proteus installed)

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 13, 2019, 4:46pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/2 "2019-11-13T16:46:31Z")

</div>

> [@narcisgarcia](#):
>
> Is there any “home page” for tryton\_demo.py ? Is it included in some stable package?

No this is an internal tool of the Tryton project. It is not versioned. All you can expect is that it works with the latest series.

> [@narcisgarcia](#):
>
> ImportError: No module named dateutil.relativedelta

It requires the [python-dateutil package](https://pypi.org/project/python-dateutil/).

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 13, 2019, 5:33pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/3 "2019-11-13T17:33:27Z")

</div>

Previously I did try to run directly with  
`./tryton_demo.py`  
(and gave same error)  
I see now that the bug begins with same script at its first line:  
`#!/usr/bin/env python`  
it should be:  
`#!/usr/bin/env python3`

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 13, 2019, 5:37pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/4 "2019-11-13T17:37:33Z")

</div>

Where is there some more documentation about tryton\_demo.py ? I want to know how to list all available modules (with this script or any other tool) and if specified database must exist, should exist, must not exist and/or it fills an already deployed database with trytond-admin

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 13, 2019, 6:18pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/5 "2019-11-13T18:18:37Z")

</div>

> [@narcisgarcia](#):
>
> Where is there some more documentation about tryton\_demo.py ?

There is no documentation because as I said it is an internal tool.

> [@narcisgarcia](#):
>
> I want to know how to list all available modules

You must check in the code.

> [@narcisgarcia](#):
>
> if specified database must exist, should exist, must not exist and/or it fills an already deployed database with trytond-admin

It must exist and initialized with `trytond-admin` but with no module activated.

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 20, 2019, 8:26pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/6 "2019-11-20T20:26:48Z")

</div>

Once I’ve created and initialized database:  
$ wget [https://hg.tryton.org/tryton-tools/raw-file/tip/tryton\_demo.py](https://hg.tryton.org/tryton-tools/raw-file/tip/tryton_demo.py)  
$ python3 tryton\_demo.py -c $ConfigFile -d $DemoDatabase

```
/usr/lib/python3/dist-packages/ldap3/utils/ciDict.py:30: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class CaseInsensitiveDict(collections.MutableMapping):
Traceback (most recent call last):
  File "tryton_demo.py", line 968, in <module>
    config_file=options.config_file)
  File "tryton_demo.py", line 874, in main
    from trytond.modules.country.scripts.import_countries import do_import
ModuleNotFoundError: No module named 'trytond.modules.country.scripts'

```

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [November 20, 2019, 10:13pm UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/7 "2019-11-20T22:13:03Z")

</div>

The tip version of the script will only work on latest released series (currently 5.4)

You should use an older version. Probably it will work with the following commands:

```
$ wget https://hg.tryton.org/tryton-tools/raw-file/effe927cf4a0/tryton_demo.py
$ python3 tryton_demo.py -c <config_file> -d <db_name>

```

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 21, 2019, 8:29am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/8 "2019-11-21T08:29:08Z")

</div>

Aleady tried with /hg.tryton.org/tryton-tools/raw-file/effe927cf4a0/tryton\_demo.py but got another error:

```
/usr/lib/python3/dist-packages/ldap3/utils/ciDict.py:30: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class CaseInsensitiveDict(collections.MutableMapping):
Traceback (most recent call last):
  File "tryton_demo.py", line 955, in <module>
    config_file=options.config_file)
  File "tryton_demo.py", line 892, in main
    setup_product(config, activated, company=company)
  File "tryton_demo.py", line 302, in setup_product
    unit, = Uom.find([('name', '=', 'Unit')])
ValueError: not enough values to unpack (expected 1, got 0)

```

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [November 21, 2019, 8:43am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/9 "2019-11-21T08:43:02Z")

</div>

Which language this you have for the admin user? If you have a diferent language than ‘en’ it will fail to find the Unit values. So you have two options here:

- Change the admin language to ‘en’
- Update the script to use our language names.

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 21, 2019, 9:01am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/10 "2019-11-21T09:01:18Z")

</div>

admin user has “ca” as user language in its preferences.  
If I change it to “en” will this distort units seen by user?

Other way; I don’t know in tryton\_demo.py line 302 what to change to adopt localized units.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [November 21, 2019, 9:15am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/11 "2019-11-21T09:15:51Z")

</div>

> [@narcisgarcia](#):
>
> admin user has “ca” as user language in its preferences.  
> If I change it to “en” will this distort units seen by user?

Easiest way is:

1. Set admin language to “en”
2. Run the demo script
3. Set admin language back to “ca” (or whatever you prefer)

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 21, 2019, 9:43am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/12 "2019-11-21T09:43:44Z")

</div>

Tried with “en” for admin. (Process really spends many time!)  
New result (I don’t know if it’s an error or a warning):

```
class CaseInsensitiveDict(collections.MutableMapping):
Field action of 131@ir.ui.menu not updated (id: menu_location_form), because it has changed since the last update

```

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [November 21, 2019, 9:59am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/13 "2019-11-21T09:59:45Z")

</div>

Those are some warnings but the processs ended correctly.  
You should be able to see the demo data on your database.

---

<div class="post-metadata">

### Author: ![narcisgarcia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/narcisgarcia/32/601_2.png) [@narcisgarcia](https://discuss.tryton.org/u/narcisgarcia)
#### Post date: [November 21, 2019, 10:30am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/14 "2019-11-21T10:30:12Z")

</div>

Yes, this worked by applying tryton\_demo.py just after initializing database with trytond-admin and not customizing anything in until this script completes.

Once this is done, I’ve done following:

1. customized “admin” account
2. enabled the rest of modules available (tryton\_demo.py only enables ~50% of tryton-modules-all)
3. Assigned all permissions to demo\_\* accounts except main “Administration”

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [December 21, 2019, 10:30am UTC](https://discuss.tryton.org/t/tryton-demo-py-usage-in-debian-10/1944/15 "2019-12-21T10:30:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
