You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to run stubgen but am running into an error
Critical error during semantic analysis: path/to/script.py:140: error: f-string: self documenting expressions are only supported in Python 3.8 and greater
But, I'm running Python 3.9.6, and mypy 0.910 which should definitely support 3.8+ since mypy 0.800 added support for 3.9.
To Reproduce
Paths to binaries
(venv) $ which python
/home/cquick/test/venv/bin/python
(venv) $ which mypy
/home/cquick/test/venv/bin/mypy
(venv) $ which stubgen
/home/cquick/test/venv/bin/stubgen
Test script successfully prints self documenting expression
(venv) $ python test.py
x = 1
But running stubgen fails
(venv) $ stubgen test.py
Critical error during semantic analysis: test.py:4: error: f-string: self documenting expressions are only supported in Python 3.8 and greater
Expected Behavior
Stubgen would run successfully.
Actual Behavior
Stubgen produces Critical error during semantic analysis
Your Environment
Mypy version used: 0.910
MypyStubgen command-line flags: stubgen test.py
Mypy configuration options from mypy.ini (and other config files): N/A
Python version used: 3.9.6
Operating system and version: Same behavior both on Ubuntu 18.04.5 LTS (WSL2) and with latest python:3-buster Docker images (currently 3.9.6) with mypy 0.910 installed.
The text was updated successfully, but these errors were encountered:
This little patch seems to get stubgen working successfully with self documenting f-strings
diff --git a/mypy/stubgen.py b/mypy/stubgen.py
index 91f461b84..920d6405b 100755
--- a/mypy/stubgen.py+++ b/mypy/stubgen.py@@ -1623,6 +1623,9 @@ def parse_options(args: List[str]) -> Options:
if ns.quiet and ns.verbose:
parser.error('Cannot specify both quiet and verbose messages')
+ if sys.version_info[:2] > pyversion:+ pyversion = sys.version_info[:2]+
# Create the output folder if it doesn't already exist.
if not os.path.exists(ns.output_dir):
os.makedirs(ns.output_dir)
But I doubt that's really the right way to fix it... Should defaults.py get updated to point to a newer default python 3 version?
Edit: or maybe add a --python-version argument to stubgen?
Bug Report
Hi, I am trying to run
stubgen
but am running into an errorBut, I'm running Python 3.9.6, and mypy 0.910 which should definitely support 3.8+ since mypy 0.800 added support for 3.9.
To Reproduce
Paths to binaries
Versions
Simple test script
Test script successfully prints self documenting expression
But running stubgen fails
Expected Behavior
Stubgen would run successfully.
Actual Behavior
Stubgen produces
Critical error during semantic analysis
Your Environment
MypyStubgen command-line flags:stubgen test.py
mypy.ini
(and other config files): N/A3.9.6
Ubuntu 18.04.5 LTS
(WSL2) and with latestpython:3-buster
Docker images (currently 3.9.6) withmypy 0.910
installed.The text was updated successfully, but these errors were encountered: