Repository navigation
Assign to variable from commented-out magic command #8183
Replies: 9 comments
|
Janosh Riebesell (@janosh) looks like there are two issues here. |
|
Transferring to lsp-middle-ware to ensure statements such as |
|
Don Jayamanne (@DonJayamanne) That's correct, 2 issues here, though the syntax error can be worked around as in the 2nd code snippet with this clunky construction. slurm_msg = ""
#! slurm_msg = {slurm_cmd}So the only real issue is the variable assignment being lost. But if there's a proper solution to the syntax error (maybe marking it as acceptable code in |
|
The middleware layer is being deprecated (and well never handled this sort of thing anyway). Might be something to do in pylance itself. |
|
there seems an issue with ipython mode |
|
Repro workspace for investigation: |
|
Transferring to discussions for up votes. Looks like it's not a very common request though. |

Uh oh!
There was an error while loading. Please reload this page.
IPython allows expanding Python variables into magic shell commands and also assigning the command's stdout to a variable:
But it seems there's no way to do this without syntax error.
microsoft/vscode-jupyter#3263 introduced
"jupyter.magicCommandsAsComments": truewhich allows to do:The shell command runs as expected but the variable assignment is lost. Any chance
magicCommandsAsCommentscould get a feature upgrade?All reactions