Syntax error for simple script
Sorry for this newbie question: I installed Python v3.6.1 on win 7. Afterwards I tried to execute the following simple python script from webpage http://www.pythonforbeginners.com/code-s...me-script/: Python Code: from datetime import datetime now = datetime.now() mm = str(now.month) dd = str(now.day) = str(now.year) hour = str(now.hour) mi = str(now.minute) ss = str(now.second) print mm + "/" + dd + "/" + + " " + hour + ":" + mi + ":" + ss When executing D:\tools\python\python.exe dateParser.py it yields a syntax error: File "dateParser.py", line 17 print mm + "/" + dd + "/" + + " " + hour + ":" + mi + ":" + ss ^ SyntaxError: Missing parentheses in call to 'print' Whats wrong? Thank you Peter -- https://mail.python.org/mailman/listinfo/python-list
"Python launcher" required to run *.py scripts on Windows?
As I observed v3.6.1 installs (on Windows 7) in addition to the core python engine a second program "Python Launcher". As far as I read this component seems to be not necessary since it only aims to facilitate the handling with *.py scripts on Windows. When I always call Python script from CommandPrompt like D:\tools\Python\python.exe mypythonscript.py then this Launcher should not be necessary. Am I right? Since I prefer to have as less prgrams installed as possible I consider to uninstall the Python Launcher. Is this possible without causing trouble to Python executions? Ben -- https://mail.python.org/mailman/listinfo/python-list
Check Python version from inside script? Run Pythons script in v2 compatibility mode?
Can I somehow check from inside a Python script if the executing Python engine is major version v2 or v3? I am thinking about a code similar to if (os.python-majorversion<3) print hello else print (hello) Additional question: Is there a way to execute a python script with v3 python engine in v2 compatibility mode? I am thinking about a command parameter like (python.exe is v3.*): python.exe -execute_as_v2 myscript.py -- https://mail.python.org/mailman/listinfo/python-list