Skip to content
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

Cannot do dafny run target:py on Windows #4922

Closed
alexporter8013 opened this issue Dec 30, 2023 · 2 comments · Fixed by #4934
Closed

Cannot do dafny run target:py on Windows #4922

alexporter8013 opened this issue Dec 30, 2023 · 2 comments · Fixed by #4934
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label

Comments

@alexporter8013
Copy link
Contributor

Dafny version

4.4.0+707b18acee078b3aa4d84c0590a980966bf22428

Code to produce this issue

method Main()
{
    print "hello, world!";
}

Command to run and resulting output

dafny run --target:py python_noworky.dfy

What happened?

When VSCode runs the above, the following is printed to the console:

Error: Unable to start python3: An error occurred trying to start process 'python3' with working directory 'C:\Users\Username\source\playground\program_proofs'. The system cannot find the file specified.

I would expect to see the same output as when doing dafny run python_noworky.dfy which is hello, world!

It seems from this perspective that the current implementation depends on the system-wide implementation being accessible globally through the command python3, which is not typically true on Windows. Additionally, there does not seem to be a way to retarget which interpreter is used, which would seem prudent to me.

Suggestions:

  • Allow command-line option to override the target interpreter.
  • Allow environmental variable to override the target interpreter.
  • Add dfyconfig.toml option for target interpreter.

What type of operating system are you experiencing the problem on?

Windows

@alexporter8013 alexporter8013 added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Dec 30, 2023
@fabiomadge
Copy link
Collaborator

Using dafny translate and running the generated sources manually seems like a decent workaround. Check out this test for a pointer.

@alexporter8013
Copy link
Contributor Author

Agreed that this is a workaround. Aside from wanting to identify issues to allow for product improvement, I also wanted to give the fix a try for my own edification.

keyboardDrummer pushed a commit that referenced this issue Jan 4, 2024
### Description
Fixes #4922 
Adds default python executable name by detected OS.

### How has this been tested?
Not tested

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants