I'm a relative newbie to Python.
I'm running Python on a VM with Windows 2012 RC2 installed.
I have Python 3.6.5 -x64 (from installer called python-3.6.5-amd64)
I've installed SQLAlchemy 1.2.6.
I'm just trying to run a simple script called 'sqlachemyver.py' with this in it:
Per this link and this one regarding the shebang
If I type python, it calls up the interpreter.
I can copy/paste the code and it spews out '1.2.6'
But I should be able to type 'python sqlachemyver.py' from the folder that contains the python, or 'sqlalchemy.py'
However the '1.2.6' is not directed as output.
If I type python sqlachemyver.py > out.txt, I get an empty file.
I can't get scripts to generate output when I run directly from the cmd shell
I'm also getting odd results in Visual Studio Code too (v1.22.2) when I try and run it:
Any pointers greatly appreciated.
Thanks.
Found answer myself...
Per here
I'm running Python on a VM with Windows 2012 RC2 installed.
I have Python 3.6.5 -x64 (from installer called python-3.6.5-amd64)
I've installed SQLAlchemy 1.2.6.
I'm just trying to run a simple script called 'sqlachemyver.py' with this in it:
1 2 3 |
#!/usr/bin/env python3 import sqlalchemy sqlalchemy.__version__ |
If I type python, it calls up the interpreter.
I can copy/paste the code and it spews out '1.2.6'
But I should be able to type 'python sqlachemyver.py' from the folder that contains the python, or 'sqlalchemy.py'
However the '1.2.6' is not directed as output.
If I type python sqlachemyver.py > out.txt, I get an empty file.
I can't get scripts to generate output when I run directly from the cmd shell
I'm also getting odd results in Visual Studio Code too (v1.22.2) when I try and run it:
Output:C:\opt\tidalconversion>cd c:\opt\tidalconversion && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:\opt\python\3.6.5-x64\python.exe C:\Users\administrator\.vscode\extensions\ms-python.python-2018.3.1\pythonFiles\PythonTools\visualstudio_py_launcher.py c:\opt\tidalconversion 61892 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput c:\opt\tidalconversion\sqlalchemyver.py "
I followed the VS Code instructions here.Any pointers greatly appreciated.
Thanks.
Found answer myself...
1 2 3 4 |
#!/usr/bin/env python import sys import sqlalchemy sys.stdout.write(sqlalchemy.__version__) |