Page content

Misc Errors and Solutions

Flask & sqlalchemy

(flask-tables-py3.10) user@host ../flask-tables> python 5
Traceback (most recent call last):
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/", line 6, in <module>
    from bootstrap_table import User, db
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/", line 18, in <module>
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/.venv/lib/python3.10/site-packages/flask_sqlalchemy/", line 868, in create_all
    self._call_for_binds(bind_key, "create_all")
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/.venv/lib/python3.10/site-packages/flask_sqlalchemy/", line 839, in _call_for_binds
    engine = self.engines[key]
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/.venv/lib/python3.10/site-packages/flask_sqlalchemy/", line 628, in engines
    app = current_app._get_current_object()  # type: ignore[attr-defined]
  File "/Users/stoege/git/mpr_2023Q1/flask-tables/.venv/lib/python3.10/site-packages/werkzeug/", line 513, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.


-> Downgrade flask-sqlalchemy to 2.5.1

# Downgrade Flask Version
gsed -i 's/flask-sqlalchemy.*/flask-sqlalchemy = "~2.5.1"/' pyproject.toml

# Rebuild Lock
poetry lock

# Install Packages
poetry install

# run again
python 5

Gitlab on Vultr

Created a Gitlab Instance on Vultr for testing Reason. Seems all fine, except:

root@gitlab:~# apt-get update
Hit:1 focal InRelease
Hit:3 focal-updates InRelease
Hit:4 focal-backports InRelease
Hit:5 focal-security InRelease
Get:2 focal InRelease [23.3 kB]
Err:2 focal InRelease
  The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
Fetched 23.3 kB in 2s (11.0 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: focal InRelease: The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
W: Failed to fetch  The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
W: Some index files failed to download. They have been ignored, or old ones used instead.


curl -s | apt-key add -
apt-get update
apt-get upgrade

Selfsigned Cert

gitlab has got a selfsigned cert on gitlab sever. like to change this.


cd /etc/gitlab/
cp gitlab.rb gitlab.rb.bak
sed -i 's/^external_url.*/external_url "https:\/\/"/' gitlab.rb
sed -i "s/^# letsencrypt\['auto_renew'\].*/letsencrypt['auto_renew'] = true/" gitlab.rb
sed -i "s/^# letsencrypt\['contact_emails'\].*/letsencrypt['contact_emails'] = ['[email protected]']/" gitlab.rb
git diff gitlab.rb.*
gitlab-ctl reconfigure

Airflow Root Login

you have Airflow running on Docker and not root login ?

docker exec -u root -ti airflow-airflow-scheduler-1 bash

Solution then, you can install all the stuff you need and fix your problems

apt-get update
apt-get upgrade
apt-get install htop lsof tree procps tcpdump net-tools mlocate dnsutils

cron & poetry

you wanna run a python script via poetry as cronjob and you get the following error:

# cronjob as root
* * * * * cd /path/to/your/script; poetry run mycode > out 2>&1

# error
Traceback (most recent call last):
  File "/usr/local/bin/poetry", line 5, in <module>
    from poetry.console.application import main
  File "/usr/local/lib/python3.9/site-packages/poetry/console/", line 19, in <module>
    from poetry.__version__ import __version__
  File "/usr/local/lib/python3.9/site-packages/poetry/", line 5, in <module>
    from poetry.utils._compat import metadata
  File "/usr/local/lib/python3.9/site-packages/poetry/utils/", line 20, in <module>
    import importlib_metadata as metadata
  File "/usr/local/lib/python3.9/site-packages/importlib_metadata/", line 6, in <module>
    import zipp
ModuleNotFoundError: No module named 'zipp'

-> set HOME as the Virtual Env is located here
* * * * * export HOME=/root; cd /path/to/your/script; poetry run mycode > out 2>&1

gpg on OpenBSD 7.4

test1@puffy $ gpg --generate-key 
gpg (GnuPG) 2.4.3; Copyright (C) 2023 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: user1
Email address: user1@puffy205
You selected this USER-ID:
    "user1 <user1@puffy205>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: agent_genkey failed: Permission denied
Key generation failed: Permission denied

seems a permission error ?!? ktrace / kdump did not help. When i allow the User for doas (root), it seems working.

solution build the key in tmux (proper handling of ownership with terminal-related device file)

gpg --generate-key


ls -l $(tty)
crw--w----  1 stoege  tty    5,   0 Jan  2 09:25 /dev/ttyp0


ls -l $(tty)
crw--w----  1 test1  tty    5,   1 Jan  2 09:27 /dev/ttyp1

Any Comments ?

sha256: 544f583153ef22c57986f77c05e773d507c695bac36353a08c02e7ad4548704f