# AttributeError: 'NoneType' object has no attribute '\_\_version\_\_'

**URL:** <https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611>\
**Category:** Get Help\
**Tags:** semaphore, gitlab, python, ubuntu\
**Created:** [March 28, 2024, 9:56am UTC](https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611 "2024-03-28T09:56:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markuman](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@markuman](https://forum.ansible.com/u/markuman)\
**Post date:** [March 28, 2024, 9:56am UTC](https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611/1 "2024-03-28T09:56:24Z")

</div>

I’m getting a strange error when trying to use `community.general.gitlab_issue` using ansible semaphore in a python virtual env

Semaphore is running as systemd service usiung .deb installation on ubuntu 22.04

```sudo
# /etc/systemd/system/semaphore.service
[Unit]
Description=Ansible Semaphore
Documentation=https://docs.ansible-semaphore.com/
Wants=network-online.target
After=network-online.target
ConditionPathExists=/usr/bin/semaphore
ConditionPathExists=/home/semaphore/config.json

[Service]
User=semaphore
Group=semaphore
Restart=always
RestartSec=10s

ExecStartPre=/bin/bash -c 'source /home/semaphore/venv/bin/activate'

ExecStart=/bin/bash -c 'source /home/semaphore/venv/bin/activate \
                        && /usr/bin/semaphore service --config /home/semaphore/config.json'
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

```

when I am entering the same virtual env that semaphore is using

```auto

semaphore@ansible:~$ virtualenv venv/
created virtual environment CPython3.10.12.final.0-64 in 858ms
  creator CPython3Posix(dest=/home/semaphore/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/semaphore/.local/share/virtualenv)
    added seed packages: Jinja2==3.1.2, MarkupSafe==2.1.3, PyMySQL==1.1.0, PyYAML==6.0.1, ansible==9.4.0, ansible_core==2.16.5, boto3==1.28.84, botocore==1.31.84, certifi==2023.7.22, cffi==1.16.0, charset_normalizer==3.3.2, cryptography==41.0.5, dnspython==2.4.2, idna==3.4, jmespath==1.0.1, looseversion==1.3.0, netaddr==0.9.0, packaging==23.2, passlib==1.7.4, pip==22.0.2, pycparser==2.21, pyspnego==0.10.2, python_dateutil==2.8.2, python_gitlab==4.4.0, pywinrm==0.4.3, requests==2.31.0, requests_credssp==2.0.0, requests_ntlm==1.2.0, requests_toolbelt==1.0.0, resolvelib==1.0.1, s3transfer==0.7.0, setuptools==59.6.0, six==1.16.0, urllib3==2.0.7, wheel==0.37.1, xmltodict==0.13.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
semaphore@ansible:~$ source /home/semaphore/venv/bin/activate
(venv) semaphore@ansible:~$ 

```

the playbook runs without any problem. But semaphore is getting just

> /gitlab\_issue.py", line 333, in main\nAttributeError: ‘NoneType’ object has no attribute ‘ **version** ’

So with other words, I cannot reproduce it. Any ideas what’s missing?

---

<div class="post-metadata">

**Author:** ![markuman](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@markuman](https://forum.ansible.com/u/markuman)\
**Post date:** [March 28, 2024, 10:19am UTC](https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611/2 "2024-03-28T10:19:24Z")

</div>

Ok, I’ve found it. The semaphore task escaped from its virtual environment because of it’s inventory. It’s connected via ssh to localhost and took the environment from the host.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [March 28, 2024, 11:38am UTC](https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611/3 "2024-03-28T11:38:58Z")

</div>

The module shouldn’t crash like this if python-gitlab isn’t installed. I’ve created a PR to fix that: [gitlab modules: do not crash if python-gitlab isn't there by felixfontein · Pull Request #8158 · ansible-collections/community.general · GitHub](https://github.com/ansible-collections/community.general/pull/8158) - it will show a nicer message telling you that `python-gitlab` isn’t available.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 27, 2024, 11:39am UTC](https://forum.ansible.com/t/attributeerror-nonetype-object-has-no-attribute-version/4611/4 "2024-04-27T11:39:38Z")

</div>

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