trying to replicate training script in windows

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

trying to replicate training script in windows

Post by joleenf »

Hi,

I am really struggling to replicate the script that used in training on my PC. It seems that there may be a 64 column limit for each line. I am not sure how to fix my script so that the errors are corrected. What is a good resource for error messages in phython?

After some adjustments for character continuation the script is now

loadBundle("C:\Documents and \
Settings\joleenf\Desktop\McIDAS\bundles\water \
vapor\ABIS_wv_color_shaded_imagetopo3_for_movie.mcv")
pause()
writeImage("C:\Documents and \
Settings\joleenf\Desktop\McIDAS\ABIS_water_vapor_Texas.gif", \
"overlay text=Brightness Temperature place UM,0,10 \
color=yellow")
print "Finished making gif..."


The error log is
Thu 06/25/2009
11:54 AM
<bundle file="C:\Documents and Settings\joleenf\Desktop\McIDASundles\water vapor\ABIS_wv_color_shaded_imagetopo3_for_movie.mcv" ></bundle>
Traceback (innermost last):
File "<string>", line 3, in ?
File "<string>", line 41, in loadBundle
An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle". line:1 column:64


at ucar.unidata.xml.XmlUtil.getDocument(XmlUtil.java:1394)

at ucar.unidata.xml.XmlUtil.getRoot(XmlUtil.java:1020)

at ucar.unidata.idv.ui.ImageGenerator.makeElement(ImageGenerator.java:2354)

at ucar.unidata.idv.ui.ImageGenerator.loadBundle(ImageGenerator.java:3283)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)


java.lang.IllegalStateException: java.lang.IllegalStateException: Error parsing xml: An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle".
An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle". line:1 column:64

Error running jython script:C:\Documents and Settings\joleenf\Desktop\scripts\ABIS_water_vapor_image.py
Traceback (innermost last):
File "<string>", line 3, in ?
File "<string>", line 41, in loadBundle
An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle". line:1 column:64


at ucar.unidata.xml.XmlUtil.getDocument(XmlUtil.java:1394)

at ucar.unidata.xml.XmlUtil.getRoot(XmlUtil.java:1020)

at ucar.unidata.idv.ui.ImageGenerator.makeElement(ImageGenerator.java:2354)

at ucar.unidata.idv.ui.ImageGenerator.loadBundle(ImageGenerator.java:3283)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)


java.lang.IllegalStateException: java.lang.IllegalStateException: Error parsing xml: An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle".
An invalid XML character (Unicode: 0x8) was found in the value of attribute "file" and element is "bundle". line:1 column:64


Thanks,
Joleen
User avatar
jayh
Posts: 424
Joined: Thu Jan 15, 2009 10:34 pm

Re: trying to replicate training script in windows

Post by jayh »

Hi Joleen-

I'm a novice for running scripts myself, but one thing I do notice is your directory syntax. Note in the following example, that on my Windows XP machine I run scripts from the "Command Prompt" with double backslashes in the directories:

I have my myloop.py file:

loadBundle("c:\\home\\jayh\\myloop.mcvz")
pause()
writeImage("c:\\home\\jayh\\myloop.jpg")
#writeMovie("c:\\home\\jayh\\myloop.gif")
print "Done..."

Maybe this needs to be done in your script as well? Otherwise, we'll get some more technical thoughts from the scripting gurus.

Thanks, Jay
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: trying to replicate training script in windows

Post by joleenf »

Thanks Jay, the single backslash in the directory names was the problem. I also noticed an error in my script where I forgot to include the "=" in the "place=" statement.

I am sorry, I am taking baby steps through this...now I am trying to run my script. My image script runs, but it creates an image on a Map Display of the entire world rather than the display set in my bundle. I checked to make sure there was only one tab in my bundle. Also, I am having troubles finding a log in my McIDAS-V directory. This is the location it was printed previously. Maybe I am remembering incorrectly.

I have another script where I am trying to make a movie. Is there any way to use a visibility animation to make a move? This movie script is failing (at least I think) with no log. How would I know that is is not running. I do not see a mcservl running in my task manager and a ps -ef does not seem to show a process, but I am not sure this works for windows.

Thanks,
Joleen
Post Reply