Post

3 followers Follow
1
Avatar

IDE for Python

Hi
Well lets populate this discussion panel.
I am interested in the IDE's used for python development using the Geomatica libraries.
Any preferences or experiences.
I guess most developers just use a text editor to write their python scripts for Geomatica. Using an IDE has certain advantages like integrating with your Current Version System.
I have dabbled with Eric some time ago and off course used IDLE but they seam to lack allot of functionality.
Many of my fellow Python programmers use PyCharm.
I do however have problems accessing the Geomatica Python libraries through PyCharm. Anyone familiar with this tool and can tell me how to configure it correctly?
What python IDE are you using?
Could you share experiences?

With kind regards

Wolfgang

Wolfgang Luck

Please sign in to leave a comment.

6 comments

3
Avatar

Hi Wolfgang, Thanks for the question. I am also using PyCharm on Windows 7 and I have had no issue with accessing the PCI libraries by default. I get all of the expected results, such as auto complete functions/classes, list arguments, etc.

However, I do know that you can setup virtual environments in PyCharm by going to File --> Settings then in the Settings panel, select Project (the active project) in the navigation pane. Then click on the config button next to the interpreter list and click More... in the pop up panel, select the correct interpreter and click on the bottom button on the right (env list). Add all of your environment paths to that list that you need. for PCI's library, go to the exe folder for your Geomatica install (one level above pci folder). In windows it is C:\PCI Geomatics\Geomatica 2014\exe

Good luck and happy coding!

Shawn Melamed 3 votes
1
Avatar

In trying to use PyCharm Edu 2.0.3 with the import pci statement and attempting to follow the steps outlined by Shawn to set-up the virtual environment; the following appears in the Python Console window of PyCharm:

Failed to initialize the PCI Pluggable Framework.

Cannot load the main PPF framework library pypf.pyd or (pypf.so for Linux).
Please check that:
1) the library and all dependent libraries are installed
2) required environment variables are set properly:
2a) PCIHOME for Geomatica, or PROHOME for GXL
2b) PATH on Windows, LD_LIBRARY_PATH on Linux
3) PCI Geomatica software is properly installed.

DLL load failed: %1 is not a valid Win32 application.

Process finished with exit code 1

Any hints on a fix ?

Oskirko, Richard 1 vote
1
Avatar

Hi Richard,

I've experienced a similar issue with initializing the PCI modules in the past. As it turned out, the issue was related to trying to import the PCI modules, which are 64-bit, using a 32-bit python interpreter. If you have software installed that also installs its own 32-bit python interpreter (i.e. ArcGIS), you will need to change the interpreter in the project settings to the correct 64-bit python 2.7 interpreter.

Try these steps:
1. Open your Python project in PyCharm
2. Clcik File --> Settings
3. On the left-side pane expand the Project:***** branch and select Project Interpreter
4. on the right (primary) pane, click on the Project Interpreter dropdown list and select the appropriate interpreter

Correct Interpreter:
- If you are using Geomatica functions and NOT using ArcGIS functions, select the interpreter that was installed with your Geomatica software (usually located in C:\Python27\python.exe)
- If you are using Geomatica functions with ArcGIS functions, you will need to install the ArcGIS 64-bit background Geoprocesses and use the interpreter that is installed with that package (usually located in C:\Python27\ArcGISx6410.2\python.exe) the specific ArcGISx64* folder will depend on the version you are using.

I hope this helps!

Shawn Melamed 1 vote
0
Avatar

Thank you Shawn: That did the trick; I now get:
PCI Pluggable Framework environment successfully loaded.

Oskirko, Richard 0 votes
0
Avatar

Hello Shawn:
Just going through some imports from the Cookbook when in the Automatically identify and calculate volume of new stockpiles script, I ran into the following when using PyCharm:

from pathcheck import *

where the following was displayed in the Python Console:

ImportError: No module named pathcheck

Process finished with exit code 1

Any ideas?

Oskirko, Richard 0 votes
0
Avatar

Hi Richard, I am going to ask our admin to move your posts to a separate thread, as it is not really related to the original topic here. Just a bit of housekeeping to keep this forum organized.

to answer your question, you have to make sure that the pathcheck.py file that was provided with the main volumetric analysis script is in the same directory as the main volumetric analysis script that you are running.

Shawn Melamed 0 votes