Pro.py and python3

Hi all,

we are using seafile pro 7.1.7 on debian 10 and we see some python3 related issues with pro.py, e.g.

sudo -u seafile ./pro.py ldapsync
/usr/bin/python: No module named parse

or

sudo -u seafile ./pro.py search --update
Updating search index, this may take a while...
/usr/bin/python: No module named queue

on debian 10, /usr/bin/python is a symlink to python2, so it is no surprise that this does not work.

there are several places where /usr/bin/python is called:

python/seafevents/office_converter/unoconv.py:#!/usr/bin/env python
python/seafevents/main.py:#!/usr/bin/env python
python/seafevents/virus_scanner/run_virus_scan.py:#!/usr/bin/env python
python/seafevents/ldap_syncer/run_ldap_sync.py:#!/usr/bin/env python
python/seafevents/content_scanner/main.py:#!/usr/bin/env python
python/seafevents/background_tasks.py:#!/usr/bin/env python
python/pyes/managers.py:#!/usr/bin/env python
python/pyes/contrib/mappings.py:#!/usr/bin/env python
python/pyes/contrib/__init__.py:#!/usr/bin/env python
python/pyes/orm/queryset.py:#!/usr/bin/env python
python/pyes/models.py:#!/usr/bin/env python
python/pyes/queryset.py:#!/usr/bin/env python
python/pyes/decorators.py:#!/usr/bin/env python
python/pyes/utils/imports.py:#!/usr/bin/env python
python/pyes/utils/compat.py:#!/usr/bin/env python
python/pyes/pyesthrift/simple_test.py:#!/usr/bin/env python
python/seafes/tests/integration/data/markdown_with_html.txt:#!/usr/bin/env python
python/bin/launch_instance:CLOUD_INIT_SCRIPT = """#!/usr/bin/env python
python/boto/services/result.py:#!/usr/bin/env python
python/boto/services/bs.py:#!/usr/bin/env python
python/boto/pyami/launch_ami.py:#!/usr/bin/env python
python/boto/pyami/installers/ubuntu/ebs.py:BackupScriptTemplate = """#!/usr/bin/env python
python/boto/pyami/installers/ubuntu/ebs.py:BackupCleanupScript= """#!/usr/bin/env python
python/boto/pyami/installers/ubuntu/ebs.py:TagBasedBackupCleanupScript= """#!/usr/bin/env python

I guess these should all be changed to “/usr/bin/env python3”.

Best,
Hp

Hello,
Same configuration (Seafile 7.1.7 / Debian10), same problem.

This is a bug in pro.py script. You can change line 291 to python3.7. This is a workaround. We’ll fix the script in the next version.

Hello,
After apply modification in pro.py, we have still an error :

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/seafile/seafile-server-latest/pro/python/seafevents/ldap_syncer/run_ldap_sync.py", line 7, in <module>
    from ldap import SCOPE_SUBTREE
ModuleNotFoundError: No module named 'ldap'

You should install python3-ldap manually, as stated in the upgrade notes: https://download.seafile.com/published/seafile-manual/upgrade/upgrade_notes_for_7.1.x.md