twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
1.06k stars 67 forks source link

BUG! Some kind of problem with code block imports and code run-blocks #292

Open Mideks opened 1 year ago

Mideks commented 1 year ago

I've been experimenting with the plugin, and I've found that exports are pretty poorly matched with run-blocks. My two code blocks are:

(python {label='block'}) python {label='block'} a = [1, 2, 3, 4, 5, 6, 7, 8] print(1, a) (python {import=['block']}) python {import=['block']} print(2, a)

And in this format, the result is quite expected: image

However, if I try to make even one of the run-python blocks, there are problems: 1. I make the first run-python block, in the second block I don't see output from the first block, I see output from the 2nd block and an incomprehensible None. Moreover, since the output from the second block occurred, it means that the first block was imported successfully, but the plugin throws an error that such a block does not exist, but it is imported (in the right corner above) image And if I comment out print in the second block, then nothing is output at all. not even None.

  1. If I declare the second block as run-python, the result is the same, except that the error is now different: image.

  2. If I declare both blocks as run-python, the result is the same as in the first point, but with no error from the plugin.