Use python to call C# dll function
Environment prepare:
-
Environment prepare: Close firewall, user control, system update
-
Install java JDK and configure environment variables.
Reference: http://jingyan.baidu.com/article/c85b7a6414f2ee003bac95d5.html -
Install python and configure environment variables, then install pip (need install 32bit Python)
Download: https://www.python.org/downloads/
Configure python environment variables: http://jingyan.baidu.com/article/48206aeafdcf2a216ad6b316.html (need to add both c:\python27 and c:\python27\scripts into path)
Install pip command: easy_install pip (in CMD, need to change to python home/scripts path: cd C:\Python27\Scripts, then run this command)
Reference: http://jingyan.baidu.com/article/e73e26c0d94e0524adb6a7ff.html -
Install IronPython (only has 32bit version, so python related tools need to install 32bit version)
Download:
http://ironpython.net/
https://github.com/IronLanguages/main/releases/download/ipy-2.7.7/IronPython-2.7.7.msi
Install pythonnet to avoid load dll error: pip install pythonnet (need to change to python home path: cd C:\Python, then run this command) -
Install wxPython: (should use 32bit version, use by Robot RIDE)
a. pip install -U wxPython
b. download link:
https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/wxPython2.8-win32-unicode-2.8.12.1-py27.exe/download -
Install Robot Framework and RIDE (2 ways)
a: install via pip command (will install the latest version, but without desktop icon for RIDE, it’s more appropriate for Testing environment)
Install command: pip install robotframework (https://pypi.python.org/pypi/robotframework)
pip install robotframework-ride (https://github.com/robotframework/RIDE/wiki/Installation-Instructions#installing-from-source)
open RIDE command: cmd C:\Python24\Python.exe C:\Python24\Scripts\ride.pyb. Install via exe file (will have desktop icon for RIDE, it’s more appropriate for DEV environment )
Download link:
https://pypi.python.org/pypi/robotframework
https://pypi.python.org/pypi/robotframework-ride -
For develop environment, also need to install Visual Studio and "Python Tools for Visual Studio"
-
Put “clr.pyd” and “Python.Runtime.dll” under “C:\Python27\Lib\site-packages” (optional)
-
Run “ride.py” in command line
if it popup error like “getDefaultPublisher() -> Publisher: SyntaxError: Invalid syntax”,
then please follow link “https://python-forum.io/Thread-WxPython-PyPubSUb-in-Python-2-7-Error”.