Invoking a custom Python Module in IDL

Source: Internet
Author: User

Calling custom pythonmodule in IDL

idl8.3 New Font-family:times new Roman ">python Module to implement in idl Tasks that are not easy to complete. If you use some development packages, but this development package does not support idl , after all, use The number of idl is still relatively small. Therefore, hybrid programming is a solution. The following describes the idl (32 bit , 32 IDL8.3 ) calls a custom pythonmodule operation steps.

1)   download Span style= "Font-family:times new Roman" >slither (the IDL Topython Bridge ). http://research.jacquette.com/slithertm-product-information/. current support PYTHON26/27/33 The version.

2) unzip the slither, select the corresponding Python file in the home DLL and the dlm file, copy it to the IDL installation path. ----exelis\idl83\bin\bin.x86. You can complete the installation of slither .

3) open IDL8.3if numpyis installed in Python . You can perform preliminary tests. The test code is as follows:

Idl>rand=pyimport ("random")

Idl>rand.randint (0,5)

4) After completing the installation of the slither , you will now start writing a custom Python Module. Select a directory to create a folder. Create two . py files in the folder, respectively. One for setup.py, the other to be named according to need, this article takes clonesvm.py as an example.

5) as shown in code 1 in the setup.py file. Where the name value and the py_modules value must be the same as their own py file.

Figure 1 setup.py file code

6) clonesvm.py is the real custom pythonmodule. Its code is shown in 2 :

Figure 2 Module Code

7) Make sure your code is correct and run setup.py. In the cmd Command window, enter the following command successively.

Python setup.py sdist

Python setup.py Install

This completes the release and installation of the custom Module . 3 The green box shows:

8) as in step 3 , use pyimport to import your own modules. At this point, you can invoke the Python module in IDL .

Invoking a custom Python Module in IDL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.