1

enter image description hereI have scoured google and SO and cannot get my .bat file to run properly:

this is what I have:

call "C:\ProgramData\Anaconda3\Scripts\activate.bat"
"c:\Users\my name\Documents\04 PRG\VS Code\Python\Scripts\myscript.py" cmd /k

When I run this it opens up my file with VS code and then stalls. I would like it to just run my script without opening anything.

Thoughts?

4
  • I believe you're missing the call to run Python in the batch file. Try: call "C:\ProgramData\Anaconda3\Scripts\activate.bat" python "c:\Users\my name\Documents\04 PRG\VS Code\Python\Scripts\myscript.py" cmd /k Commented Dec 12, 2019 at 18:16
  • Is the virtual environment being activated correctly? e.g. when you run call "C:\ProgramData\Anaconda3\Scripts\activate.bat" in a terminal. Additionally, try using python to run the program: python c:\Users\my name\Documents\04 PRG\VS Code\Python\Scripts\myscript.py Commented Dec 12, 2019 at 18:20
  • Neither of these quite solve me 100% I can get base to activate but it won't run my script for some reason. I have added what prints out when I run it manually in VS code and it succeeds. Commented Dec 12, 2019 at 19:07
  • I can get python to come up when I run the batch now I just cannot get the script to run. Commented Dec 12, 2019 at 19:13

1 Answer 1

4
call "C:\ProgramData\Anaconda3\Scripts\activate.bat" 
python "C:\Users\me\Documents\04 PRG\VS Code\Python\Scripts\myscript.py"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.