pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.92k stars 859 forks source link

SystemError: initialization of md__mypyc did not return an extension module #1736

Open mi-robin opened 10 months ago

mi-robin commented 10 months ago

Bug summary

SystemError as title happens when importing jira inside Reaper's ReaScript for the second time

Is there an existing issue for this?

Jira Instance type

Jira Server or Data Center (Self-hosted)

Jira instance version

No response

jira-python version

3.5.2

Python Interpreter version

3.11

Which operating systems have you used?

Reproduction steps

# 0. On macOS, prepare Python and Reaper
- `pip3 install jira`
- Configure Reaper's ReaScript Python runtime preferences to:  
  - Custom path to Python DLL directory: `/Library/Frameworks/Python.framework/Versions/3.11/lib`
  - Force Reaper to use specific Python .dylib: `libpython3.11.dylib`

# 1. Copy and save the following code as a ReaScript: hello_reapi.py

import sys
import reaper_python as rp
import jira
rp.RPR_ShowMessageBox('hello reaper', 'dbg', 0)

# 2. Install the script as a Reaper Action
- Open Reaper
- Hit menu: Actions > Show action list ...
- Hit button `New Action` > Load ReaScript ... and install the above script

# 3. Run the script for the first time
- You should see the message box without errors
- Action dialog now quits normally

# 4. Repeat Step 3
- You should see a popup error dialog showing the error callstack in the stack trace below

Stack trace

Script execution error

Traceback (most recent call last):
  File "hello_reapi.py", line 5, in <module>
    import jira
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jira/__init__.py", line 11, in <module>
    from jira.client import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jira/client.py", line 43, in <module>
    import requests
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/__init__.py", line 48, in <module>
    from charset_normalizer import __version__ as charset_normalizer_version
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 24, in <module>
    from .api import from_bytes, from_fp, from_path, is_binary
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/api.py", line 5, in <module>
    from .cd import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/cd.py", line 9, in <module>
    from .md import is_suspiciously_successive_range
SystemError: initialization of md__mypyc did not return an extension module

Expected behaviour

There should be no errors

Additional Context

Setup:

Debugging