Python Scripting and opticks._genwrap() module

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Python Scripting and opticks._genwrap() module

This post has NOT been accepted by the mailing list yet.

I have a series of .hdr files (>1000) that I need to convert to .png or .bmp files so that I can merge them into a .avi or .mpeg.  I want to automate this process in the python script.  The first step is writing the script and importing into Opticks.  

Question 1.  If I have a script that I have proofed in IDLE, and saved it, how can I execute the script at the Opticks command line. I successfully set the current working directory using os.chdir(<my_scripting_dir>).  I have tried to execute the script using python.exe but did not work.

Question 2 Is there a suggested way to proof my python script (like IDLE) so I don't have to type in a line every time.  Perhaps Question 1 will answer this.

Question 3 Here is the beginnings of my script.
import os,sys,glob
from os.path import basename,splitext
import ctypes
import opticks.load_file = opticks._genwrap("loadFile", ctypes.c_uint32, ctypes.c_char_p, ctypes.c_int)

def main():
    fname=[splitext(basename(i))[0] for i in files]
    #print files[0]
    for i in range(0,len(files)):
    #print fname[0]
opticks.load_file(fname[0], 0)

if __name__ == '__main__':

I have successfully typed in all of the lines in the scripting window.  I have demonstrate my ability to call up any filename in my directory.  The problem comes when I attempt to load it into Opticks.  Can you offer any assistance on the proper use of the opticks._genwrap module?

That's it for now... I appreciate your help.