Ubuntu 16: raise AttributeError(f"module {__name__} has no attribute {name}") #457

Closed
opened 2021-10-04 06:59:09 +00:00 by jurgenhaas · 4 comments

What I'm trying to do and why

Steps to reproduce (if a bug)

Starting last Friday, Oct 1st, using borgmatic 1.5.18 raises the following exception for any of its commands:

Traceback (most recent call last):
  File "/usr/local/bin/borgmatic", line 5, in <module>
    from borgmatic.commands.borgmatic import main
  File "/usr/local/lib/python3.5/dist-packages/borgmatic/commands/borgmatic.py", line 25, in <module>
    from borgmatic.config import checks, collect, convert, validate
  File "/usr/local/lib/python3.5/dist-packages/borgmatic/config/validate.py", line 3, in <module>
    import jsonschema
  File "/usr/local/lib/python3.5/dist-packages/jsonschema/__init__.py", line 56
    raise AttributeError(f"module {__name__} has no attribute {name}")
                                                                    ^
SyntaxError: invalid syntax

The config file looks like this, but has been unchanged for over a year:

location:
    source_directories:
        - /etc
        - /var/www/live/htdocs/sites
    repositories:
        - /var/backups/borg/default
        - xyz@xyz.repo.borgbase.com:repo
    one_file_system: true
    exclude_patterns:
        - '*.log'
        - '*.pyc'
        - '*/.git'
        - '*/.svn'
        - '*/vendor/*'
        - '*/node_modules/*'
    exclude_caches: true
    exclude_if_present: '.nobackup'
storage:
    encryption_passphrase: 'something'
retention:
    keep_daily: 7
    keep_weekly: 8
    keep_monthly: 12
    keep_yearly: 30
consistency:
    checks:
        - repository
        - archives
hooks:
    before_backup:
        - echo "`date` - Starting backup"
    after_backup:
        - echo "`date` - Finished backup"
    on_error:
        - /usr/local/bin/alertalerta.py host company https://alerta.example.com/api APIKEY '{"service":["https://www.borgbase.com"],"resource":"host","event":"Borg {configuration_filename}","value":"{repository}","text":"Borg {configuration_
filename}","rawData":"{output}"}'

Environment

borgmatic version: 1.5.18

borgmatic installation method: PIP3

Borg version: 1.1.17

Python version: 3.5.2

operating system and version: Ubuntu 16

#### What I'm trying to do and why #### Steps to reproduce (if a bug) Starting last Friday, Oct 1st, using borgmatic 1.5.18 raises the following exception for any of its commands: ``` Traceback (most recent call last): File "/usr/local/bin/borgmatic", line 5, in <module> from borgmatic.commands.borgmatic import main File "/usr/local/lib/python3.5/dist-packages/borgmatic/commands/borgmatic.py", line 25, in <module> from borgmatic.config import checks, collect, convert, validate File "/usr/local/lib/python3.5/dist-packages/borgmatic/config/validate.py", line 3, in <module> import jsonschema File "/usr/local/lib/python3.5/dist-packages/jsonschema/__init__.py", line 56 raise AttributeError(f"module {__name__} has no attribute {name}") ^ SyntaxError: invalid syntax ``` The config file looks like this, but has been unchanged for over a year: ``` location: source_directories: - /etc - /var/www/live/htdocs/sites repositories: - /var/backups/borg/default - xyz@xyz.repo.borgbase.com:repo one_file_system: true exclude_patterns: - '*.log' - '*.pyc' - '*/.git' - '*/.svn' - '*/vendor/*' - '*/node_modules/*' exclude_caches: true exclude_if_present: '.nobackup' storage: encryption_passphrase: 'something' retention: keep_daily: 7 keep_weekly: 8 keep_monthly: 12 keep_yearly: 30 consistency: checks: - repository - archives hooks: before_backup: - echo "`date` - Starting backup" after_backup: - echo "`date` - Finished backup" on_error: - /usr/local/bin/alertalerta.py host company https://alerta.example.com/api APIKEY '{"service":["https://www.borgbase.com"],"resource":"host","event":"Borg {configuration_filename}","value":"{repository}","text":"Borg {configuration_ filename}","rawData":"{output}"}' ``` #### Environment **borgmatic version:** 1.5.18 **borgmatic installation method:** PIP3 **Borg version:** 1.1.17 **Python version:** 3.5.2 **operating system and version:** Ubuntu 16
Author

BTW, same config on Ubuntu 18 and 20 is running just fine.

BTW, same config on Ubuntu 18 and 20 is running just fine.
Owner

Thanks for reporting this! It looks like the system where you're encountering this issue is running Python 3.5, which borgmatic (and in this case, jsonschema) does not support because it has been end-of-lifed. So my recommendation is to either upgrade Python or upgrade Ubuntu (which should get you a newer version of Python). If that isn't possible for whatever reason, you can downgrade to borgmatic 1.5.12 (the last version to support Python 3.5). However, old versions of borgmatic aren't supported, either!

Let me know your thoughts.

Thanks for reporting this! It looks like the system where you're encountering this issue is running Python 3.5, which borgmatic (and in this case, jsonschema) does not support because it has been end-of-lifed. So my recommendation is to either upgrade Python or upgrade Ubuntu (which should get you a newer version of Python). If that isn't possible for whatever reason, you can downgrade to borgmatic 1.5.12 (the last version to support Python 3.5). However, old versions of borgmatic aren't supported, either! Let me know your thoughts.
witten added the
question / support
label 2021-10-04 18:11:56 +00:00
Author

Thanks @witten for your reply. I know this is a bad one. This client of mine has a few dozen hosts that I manage for them, most already upgraded to Ubuntu 18 or even 20, but 4 of them will be switched off soon but still run Ubuntu 16 which is not worth updating for them.

I've tried updateing Python to 3.6 but that comes with a whole lot of other issues.

So I stick with your suggestion to downgrade borgmatic which seems to be reasonable for that period of time until those old hosts got replaced.

Thanks @witten for your reply. I know this is a bad one. This client of mine has a few dozen hosts that I manage for them, most already upgraded to Ubuntu 18 or even 20, but 4 of them will be switched off soon but still run Ubuntu 16 which is not worth updating for them. I've tried updateing Python to 3.6 but that comes with a whole lot of other issues. So I stick with your suggestion to downgrade borgmatic which seems to be reasonable for that period of time until those old hosts got replaced.
Owner

Glad to hear that'll work out for you!

Glad to hear that'll work out for you!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#457
No description provided.