chialiyun / DiagramsPreviewerVSCExt

Visual Studio Code Extension to preview Diagrams (Diagram as a Code)
MIT License
6 stars 0 forks source link

Error executing the code, please make sure you have Python3... #1

Closed heathsnow closed 2 years ago

heathsnow commented 2 years ago

Description

At one point this extension worked...but I now only get the following error in VSCode:

Error executing the code, please make sure you have Python3 (3.6 or higher) with the relevant packages (diagrams) and Graphviz installed. You may refer to the Requirements section for more information.

OS: macOS Monterey version 12.2 Python: 3.9.12 Graphviz: 3.0.0

chialiyun commented 2 years ago

Hi @heathsnow, thank you for reaching out and sorry that you are facing an issue with the extension!

May I ask if you have tried to reinstall the extension?

If it still does not work, could you try to run python3 <path to your file> and let me know again if you receive an error on doing so? 🤓

heathsnow commented 2 years ago

I reinstalled the extension and still no luck. I'm able to create the diagram fine from the command line as well. out

chialiyun commented 2 years ago

@heathsnow, thank you for trying out the suggestion and sharing the outcome with a gif, that certainly has helped us to figure out the issue. Currently, for mac, the extension runs with python3 by default as it typically comes installed like that on mac.

Having said that, we will definitely be looking into providing such flexibility. We will update you again once it's supported ASAP. In the meantime, in order to you use the extension, you might have to switch back to the default case of running version 3 of python using python3.

My apologies on the inconvenience caused! Please bear with us at the moment 🙈.Thank you!! 🙇‍♀️

chialiyun commented 2 years ago

@heathsnow, we have just released a new version (1.0.5). In that version, you may set the python command that runs version 3 of python on your machine via extension settings. You could set it to python and the extension should work for you again.

Hope this would resolve the problem you are facing and feel free to let me know if there is still any issues. Thank you!! 🤓

image

FYI: Here's a link on how to get to the settings page in Visual Studio Code.

heathsnow commented 2 years ago

Hi @chialiyun ,

Thank you for taking the time to address this issue....I really appreciate it. Unfortunately I'm seeing the same behavior. In this gif I even launched a Codespace directly within this repository to ensure it wasn't a system issue. I tried with the setting set to default, python, and python3. out

chialiyun commented 2 years ago

@heathsnow thank you so much for attempting to run in codespace to verify that it wasn't a system issue. Really appreciate that. I have figured out the issue. It wasn't related to python version.

I see in your code, you have specified filename. This is breaking the extension as currently we append with a fix filename when we execute the code. Your issue should be resolved if you do not specify the filename attribute.

Instead of:

with Diagram(filename="test", show=False):

Do this instead

with Diagram(show=False):

Should you need to save the image, there is a download button (top left corner) on the previewer window and you can save to a directory of our choice (this is a new feature that was released about a month ago).

image

We will take note of this potential issue and fix it on our end ASAP. Hope this resolve your issue and the existing version is able to support your use cases. On a side note, feel free to let us know what other functionality do you wish to have it supported on this extension so that we can serve you better.

Cheers!! 🤓

heathsnow commented 2 years ago

That did the trick! Thank's again for looking into it. It would probably help to have that info in the README.md but if you're fixing it soon perhaps it can wait.