Did you try autorest --reset and attempt again? Yes
Setup (please complete the following information): **
OS: Windows
OS Version: 21H2
Mode: VSCode
VSCode extension version:
Language to be generated: ? Python
Autorest Core version: (see table)
Type
Extension Name
Version
extension
@autorest/azure-functions-python
0.1.0-preview
core
@autorest/core
3.0.6320
core
@autorest/core
3.8.3
extension
@autorest/modelerfour
4.15.414
Describe the bug
When attempting to scaffold a project using the VSCode extension (Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)), the process fails with the following error:
10:32:13 AM: Running command: "autorest --input-file:"c:\development\test\example_OpenAPIv3.json" --version:3.0.6320 --azure-functions-python --no-namespace-folders:True --no-async --generate-metadata:false --output-folder:"c:\development\test""...
AutoRest code generation utility [cli version: 3.6.1; node: v17.8.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | AutoRest core version selected from configuration: 3.0.6320.
Loading AutoRest core 'C:\Users\%USER%.autorest\@autorestcore@3.0.6320\nodemodules\@autorest\core\dist' (3.0.6320)
Loading AutoRest extension '@autorest/azure-functions-python' (latest->0.1.0-preview)
Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)
WARNING (PreCheck/CheckDuplicateSchemas): Checking for duplicate schemas, this could take a (long) while. Run with --verbose for more detail.
API Exception: {'type': 'ModuleNotFoundError', 'args': ("No module named 'm2r'",), 'message': "No module named 'm2r'"}
Traceback (most recent call last):
File "C:\Users\%USER%.autorest\@autorest_azure-functions-python@0.1.0-preview\node_modules\@autorest\azure-functions-python\venv\lib\site-packages\jsonrpc\manager.py", line 113, in _get_responses
result = method(*request.args, **request.kwargs)
File "C:\Users\%USER%.autorest\@autorest_azure-functions-python@0.1.0-preview\node_modules\@autorest\azure-functions-python\autorest\jsonrpc\server.py", line 34, in Process
from ..m2r import M2R as PluginToLoad
File "C:\Users\%USER%.autorest\@autorest_azure-functions-python@0.1.0-preview\node_modules\@autorest\azure-functions-python\autorest\m2r__init__.py", line 11, in
import m2r
ModuleNotFoundError: No module named 'm2r'
Error: Server error
10:32:17 AM: Error: Failed to run "autorest" command. Check output window for more details.
Strongly suspect this is due to one of the dependencies--or rather, dependencies' dependency mistune--having a breaking change when it went from 0.8.4 to 2.0.x. The Common Errors section of the autorest.az FAQ was invaluable in figuring out the workaround (see Additional Context below for the workaround).
To Reproduce
Prerequisites:
VSCode with the Azure Functions extension
autorest installed (npm install -g autorest)
folder opened in VSCode, with an empty file named test.json
From the VSCode extension, Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
Select test.json as the file
Error will be reproduced as described above.
Additional context
Was able to resolve the issue by activating the autorest venv and installing a pinned version of mistune, then also installing the other dependencies it blocked.
Troubleshooting:
autorest --reset
and attempt again? YesSetup (please complete the following information): **
Describe the bug
When attempting to scaffold a project using the VSCode extension (
Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
), the process fails with the following error:Strongly suspect this is due to one of the dependencies--or rather, dependencies' dependency
mistune
--having a breaking change when it went from 0.8.4 to 2.0.x. The Common Errors section of the autorest.az FAQ was invaluable in figuring out the workaround (see Additional Context below for the workaround).To Reproduce
Prerequisites:
npm install -g autorest
)test.json
Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
Error will be reproduced as described above.
Additional context Was able to resolve the issue by activating the autorest venv and installing a pinned version of mistune, then also installing the other dependencies it blocked.
Once those steps are taken, it works fine. Perhaps pinning the mistune version within autorest would resolve for future users?