How to run python 3 with nodemon?

Viewed 1215

I have a simple script in python 3. I want to run with nodemon so that it can start automatically when the file changes. On nodemon npm, I have this code : nodemon --exec "python -v" ./app.py. The issue is that python version 3 is not enforced.

my python file looks like this:

#!/usr/bin/env python3
print "hello world!"

This code is working perfectly, this means Python 3 is not enforced.

How can I use nodemon and make sure it use Python 3 instead of 2?

2 Answers

You can just use this:

nodemon --exec python3 hello.py

I found the answer here, it works well for me.

I found a better solution: I just install reload and run reload ./myscript.py. VoilĂ 

Related