Difference between revisions of "Python"

From TSG Doc
Jump to navigation Jump to search
m
 
(6 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
| latest preview version =  
 
| latest preview version =  
 
| latest preview date    = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| latest preview date    = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| installed version      = 3.7.9 64-bits
+
| installed version      = 3.10.11 64-bits
 
| installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| status                = Active
 
| status                = Active
Line 21: Line 21:
 
| resources              = {{Infobox tsg
 
| resources              = {{Infobox tsg
 
   | child = yes
 
   | child = yes
   | header2 = Workshop
+
   | header1 = Workshop
   | data2 = {{bulleted list
+
   | data1 = {{bulleted list
 
       | [[Workshop: Python for behavioural scientists|Python for behavioural scientists]]
 
       | [[Workshop: Python for behavioural scientists|Python for behavioural scientists]]
 
   }}
 
   }}
Line 28: Line 28:
 
}}
 
}}
  
[[wikipedia:Python_(programming_language)|Python]] is a general-purpose, high-level programming language. It is also a [[wikipedia:Python_%28genus%29|type of snake]] and a [[wikipedia:Python_%28Efteling%29|rollercoaster]], but one is arguably more relevant to your research than the others. <br/>
+
[[wikipedia:Python_(programming_language)|Python]] is a general-purpose, high-level programming language. It is also a [[wikipedia:Python_%28genus%29|type of snake]] and a [[wikipedia:Python_%28Efteling%29|rollercoaster]], but the language is probably more relevant to your research. <br/>
 
On the lab computers, there is support for Spyder, PyCharm and [[Psychopy]].  
 
On the lab computers, there is support for Spyder, PyCharm and [[Psychopy]].  
  
 
<!-- Table of Contents will be generated here -->
 
<!-- Table of Contents will be generated here -->
  
==Upgrade from 2.7 to 3.7==
+
==Psychopy==
Since Python version 2.7 has reached end of life since January first 2020, this version is no longer installed on our [[System Image]]. Standard is now: Python 3.7 64-bits.
+
{{see also|Psychopy}}
If you still have scripts written in Python2, the scripts should be upgraded to Python 3. Most changes are probably the print statements. Print statements should always have parentheses: print('some text')
 
Key differences between Python 2 and Python 3 are here: https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
 
  
For our previous documentation for Python 2.7, see [[Python/Legacy]]
 
 
==Psychopy==
 
Psychopy 2020.2.10 has been installed in the root of the Python3.7 64-bit version. This is also the default version when 'psychopy' is typed from the command prompt. It is also the default that opens when a .py file is double-clicked. It also can be started by clicking the appropriate icon on the desktop.
 
There is also a Psychopy 2020.2.10 installed on Python3.6 32-bits. This version has its own icon on the desktop and should be used when you are using a [[Tobii Eye Tracker]].
 
 
 
When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.
 
When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.
  
Line 52: Line 44:
 
You should see the following result:
 
You should see the following result:
  
<syntaxhighlight lang="matlab" overflow:auto;">
+
<syntaxhighlight lang="python" overflow:auto;">
 
number of argument:  2
 
number of argument:  2
 
  argv[0]: ./testArgs.py
 
  argv[0]: ./testArgs.py

Latest revision as of 14:38, 16 April 2026

Python
Python(tm)
Installed version3.10.11 64-bits
Development statusActive
Written inPython
Websitepython.org
Workshop

Python is a general-purpose, high-level programming language. It is also a type of snake and a rollercoaster, but the language is probably more relevant to your research.
On the lab computers, there is support for Spyder, PyCharm and Psychopy.


Psychopy

See also: Psychopy

When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.

Usage

Example: TestArgs.py

Execute the following script within the commandline (CMD): python testArgs.py a.
You should see the following result:

number of argument:  2
 argv[0]: ./testArgs.py
 argv[1]: a

See Also

External Links