Scripting Tools

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
henryb
Posts: 41
Joined: Mon Oct 29, 2012 3:16 pm

Scripting Tools

Post by henryb »

Hi there,
I have been scripting for a while with the default tools:
"Jython Library" GUI
"Jython Shell" GUI

But its getting a bit tedious using such a minimal editor.
I want to use emacs in python mode - but when I edit my scripts in my home directory :
~/McIDAS-V/python
The new files are not being picked up McIDAS --

How can I code and compile while I am running a live McIADAS session ?
Many thanks

... Henry
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Scripting Tools

Post by joleenf »

Hi Henry,

I am not sure if I understand the question correctly. I am on a mac, so when I am testing code, I like to use TextWrangler. I write the code in TextWrangler and copy and paste from TextWrangler into the jython shell. Alternatively, you can run McIDAS-V form the command line. Instructions for running from the command line are in the McIDAS-V documentation

http://www.ssec.wisc.edu/mcidas/doc/mcv ... pting.html

Unless you are working from the directory where runMcV is located, you will need to provide the full path name. Please respond and let me know if this answers your question. I am sorry, I don't have much experience with emacs, I tend to use vi. When working from an xterm, it is slightly more difficult to cut and paste.

Joleen
User avatar
mhiley
Posts: 90
Joined: Mon Jan 23, 2012 10:22 pm

Re: Scripting Tools

Post by mhiley »

Hi Henry,

If I'm understanding your question correctly, I think there are 2 slightly distinct issues here:

(1) If you add a new '.py' file to your 'McIDAS-V/python' directory, will it appear in the Jython Library? and will the functions defined there be available in the Jython Shell?

After some quick tests, it appears the answer is no. It seems like a reasonable feature request though- what do others think about the idea?

What you *can* do right now is add custom function or class definitions to the 'McIDAS-V/python/default.py' file, which will then be automatically imported into a Jython Shell session, and appear in the Jython Library under "Local Jython -> User's Library". However, if you edit this file in a text editor outside of McIDAS-V, you'll need to restart McV to see the changes. Which brings the second question-

(2) Is there a way to have McV recognize that you have made changes to a Python module on your hard drive without restarting McV (this is how I interpret your question: "can I code and compile while I am running a live McIDAS session").

It appears the answer is "no" for now, though I could imagine adding a "refresh" button to the Jython Library that re-scans your 'McIDAS-V/python' directory and imports new code. Again, I'm curious what others think about this..

Let me know if I'm mis-interpreting anything!
Mike
User avatar
henryb
Posts: 41
Joined: Mon Oct 29, 2012 3:16 pm

Re: Scripting Tools

Post by henryb »

Hi Mike,
thank you for your quick reply.
You have interpreted my question correctly.
Yes a refresh button would solve the problem

... Henry
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Scripting Tools

Post by joleenf »

Hi Mike,

#2 is very useful, so is #1. However, if there is limited time, #2 would be a higher priority. If that makes any sense.

Joleen
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: Scripting Tools

Post by Rick »

The following inquiry has been opened to address the requested features:

http://mcidas.ssec.wisc.edu/inquiry-v/?inquiry=1480
Post Reply