Skip to content

Bug in Export as Python script #1405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlbertDeFusco opened this issue Oct 10, 2020 · 4 comments
Closed

Bug in Export as Python script #1405

AlbertDeFusco opened this issue Oct 10, 2020 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@AlbertDeFusco
Copy link

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Launch a new or existing notebook with code and markdown
  2. Click "Export as" and select Python Script

Actual behavior

The cell marker for markdown in the exported script file appears as

null.tpl [markdown]
# ## heading

Expected behavior

In version v2020.9.112786 the output python script appears as follows

# %% [markdown]
# ## heading

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: v2020.9.114305
  • VS Code version: 1.50.0
  • Setting python.jediEnabled: false
  • Setting python.languageServer: Microsoft
  • Python and/or Anaconda version: 3.7 and 3.8
  • OS: Mac
  • Virtual environment: conda

Python Output

> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> ~/Applications/miniconda3/envs/hv5/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> ~/Applications/miniconda3/bin/conda info --json
Starting Microsoft Python language server.
> ~/Applications/miniconda3/bin/conda env list
Python interpreter path: ~/Applications/miniconda3/envs/hv5/bin/python
> ~/Applications/miniconda3/bin/conda env list
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/Applications/miniconda3/envs/hv5/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Desktop/t -s --cache-clear
cwd: ~/Desktop/t
Error 2020-10-10 11:25:54: Failed to parse discovered Test [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
> ~/Applications/miniconda3/bin/pytest --version
Error 2020-10-10 11:25:54: Python Extension: displayDiscoverStatus [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py -c "import nbconvert"
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python (daemon) -m jupyter nbconvert /var/folders/lk/s__7f9fx15x_zrw6q5xkmm500000gp/T/079a338f-17a4-4099-bc8e-d7e892f4ed32/tmp-24986s97W0AoEEAEI.ipynb --to python --stdout --template /var/folders/lk/s__7f9fx15x_zrw6q5xkmm500000gp/T/tmp-24986TD26cET8TVOb.tpl
> ~/Applications/miniconda3/envs/hv5/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Desktop/t -s
cwd: ~/Desktop/t
Error 2020-10-10 11:28:09: Failed to parse discovered Test [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
> ~/Applications/miniconda3/envs/hv5/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Desktop/t -s
cwd: ~/Desktop/t
Error 2020-10-10 11:28:12: Failed to parse discovered Test [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
Starting Microsoft Python language server.
Python interpreter path: ~/Applications/miniconda3/envs/data/bin/python
> ~/Applications/miniconda3/bin/conda info --json
> ~/Applications/miniconda3/bin/conda info --json
> ~/Applications/miniconda3/envs/data/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Desktop/t -s --cache-clear
cwd: ~/Desktop/t
Error 2020-10-10 11:28:14: Failed to parse discovered Test [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
> ~/Applications/miniconda3/bin/pytest --version
Error 2020-10-10 11:28:14: Python Extension: displayDiscoverStatus [r [Error]: Traceback (most recent call last):
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

	at ChildProcess.<anonymous> (/Users/adefusco/.vscode/extensions/ms-python.python-2020.9.114305/out/client/extension.js:9:53541)
	at Object.onceWrapper (events.js:313:26)
	at ChildProcess.emit (events.js:223:5)
	at ChildProcess.EventEmitter.emit (domain.js:475:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)]
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python ~/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/pyvsc-run-isolated.py jupyter nbconvert --version
> ~/Applications/miniconda3/envs/plot/bin/python (daemon) -m jupyter nbconvert /var/folders/lk/s__7f9fx15x_zrw6q5xkmm500000gp/T/45b5a54d-be0e-40be-b683-0045c063ac6b/tmp-24986ZT61YC7tA6Bk.ipynb --to python --stdout --template /var/folders/lk/s__7f9fx15x_zrw6q5xkmm500000gp/T/tmp-24986TD26cET8TVOb.tpl

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

@cliu268
Copy link

cliu268 commented Oct 10, 2020

@joyceerhl
Copy link
Contributor

joyceerhl commented Oct 10, 2020

Hi @AlbertDeFusco, thanks for highlighting this. I can repro this bug. I've put up a fix to correct this in microsoft/vscode-python#14360 and the bug fix will be available in our next release. Thanks again for bringing this to our attention!

@cliu268, the bug you linked to is a separate issue—would you mind filing a new issue with more details on your Python environment so that we can assist you: https://github.com/microsoft/vscode-python/issues/new?labels=type-bug%2C+data+science&template=1_ds_bug_report.md Many thanks!

@cliu268
Copy link

cliu268 commented Oct 11, 2020

Thanks @joyceerhl the issue appears to be with python 3.9 and I found some documented solution here https://discuss.codecademy.com/t/having-trouble-installing-jupyter-notebooks/537292
I am reverting back to 3.7 for now.

@joyceerhl joyceerhl self-assigned this Oct 11, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug temp-validate and removed temp-validate labels Nov 13, 2020
@rchiodo
Copy link
Contributor

rchiodo commented Nov 16, 2020

Validated

@rchiodo rchiodo closed this as completed Nov 16, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants