# Supported IDEs ## Python Shell IDLE This is the default IDE. It can be started from Windows Start Menu or by calling `C:/Python/Lib/idlelib/idle.py`: : ![Python IDLE shell window showing the default IDE environment for running Python code](Media/shell-idle.png) In this shell, the user can simply copy&paste the sample code from: `Examples/EcMasterDemoPython/EcDemoAppInteractive.py` : ```python exec(""" import os import sys INSTALLDIR = "C:/Program Files/acontis_technologies/EC-Master-Windows-x86_64Bit/" os.environ["PATH"] += os.pathsep + INSTALLDIR + "Bin/Windows/x64" sys.path.append(INSTALLDIR + "Sources/EcWrapperPython") sys.path.append(INSTALLDIR + "Examples/EcMasterDemoPython") from EcDemoApp import \* demo = EcMasterDemoPython() demo.pAppParms.tRunMode = RunMode.Master demo.pAppParms.dwBusCycleTimeUsec = 4000 demo.pAppParms.szENIFilename = "ENI.xml" demo.pAppParms.szLinkLayer = "ndis 127.0.0.0 1" demo.pAppParms.nVerbose = 3 demo.startDemo() print("EcMasterDemoPython is running.") print("Type demo.help() for interactive help.") """) ``` … and the demo is running. : ![Python IDLE shell window showing EcMasterDemoPython running in interactive mode](Media/shell-idle_ecmasterdemo.png) ## Visual Studio 2019 Create a new project: : ![Visual Studio 2019 shows create a new project dialog](Media/vs2019_cerate-new-project.png) Configure the project: : - Replace the generated file `EcMasterDemoPython.py` with the existing `EcDemoApp.py`.
![Visual Studio 2019 shows configure your new project dialog](Media/vs2019_configure-new-project.png) Configure project General settings: : - Startup File: `EcDemoApp.py`
![Visual Studio 2019 shows general tab of new generated Python appliation project](Media/vs2019_configure-new-project-2.png) Configure project Debug settings: : - Search Paths:
```default ../../Sources/EcWrapperPython;../EcMasterDemoPython ```
- Script Arguments:
```default -mode 1 -file ENI.xml -link "ndis 127.0.0.0 1 1" -cycletime 4000 -time 1000 -lvl 3 ```
- Environment Variables:
```default PATH=../../Bin/Windows/x64;%PATH% ```
![Visual Studio 2019 shows debug tab of new generated Python appliation project](Media/vs2019_configure-new-project-3.png) Press Start and the demo is running: : ![Command prompt window showing EcMasterDemoPython](Media/cmd_ecmasterdemo.png) ## Visual Studio Code Install python extension by open extension tab and enter python: : ![Visual Studio Code Extensions tab showing the Python extension](Media/vscode_install-phyton-extension.png) Open folder `Examples/EcMasterDemoPython` and configure the `launch.json`: : ```json { "version": "0.2.0", "configurations": [ { "name": "Python: Aktuelle Datei", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "cwd": "", "args" : [ "-mode", "1", "-file", "ENI.xml", "-link", "ndis 127.0.0.1 1", "-cycleTime", "4000", "-time", "1000", "-lvl", "3", ], "env": {"PYTHONPATH": "${workspaceRoot}"} } ] } ```
![Visual Studio Code showing the launch.json configuration for running EcMasterDemoPython with cmdline parameters](Media/vscode_install-phyton-extension-2.png) Configure linter in `settings.json`: : ```json { "git.ignoreLimitWarning": true, "python.linting.pylintArgs": [ "--init-hook='import sys; sys.path.append(\"C:/Temp/EC-Master-Windows-x86_64Bit/Sources/EcWrapperPython\")'" ] } ```
![Visual Studio Code showing the settings.json configuration for Python linter](Media/vscode_install-phyton-extension-3.png) Open `EcDemoApp.py` and the following lines to set environment: : ```python import os import sys INSTALLDIR = "C:/Temp/EC-Master-Windows-x86_64Bit/" os.environ["PATH"] += os.pathsep + INSTALLDIR + "Bin/Windows/x64" sys.path.append(INSTALLDIR + "Sources/EcWrapperPython") sys.path.append(INSTALLDIR + "Examples/EcMasterDemoPython") ```
![Visual Studio Code showing EcDemoApp.py with possbile environment setup lines](Media/vscode_install-phyton-extension-4.png) Start debugging and the demo output will be written into the terminal: : ![Visual Studio Code debug session showing EcMasterDemoPython console output in the integrated terminal](Media/vscode_install-phyton-extension-5.png)