- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
At work, I've written some Python scripts to pull a bunch of data from our database, save it as a CSV, open it in JMP, and run a JSL script on it to create some graphs and other junk. The problem I'm running into is that I cannot find a way to get the full path to the CSV file within the JSL script.
The Python script creates the directory, moves the CSV into it, and then opens the CSV in JMP and immediately runs the JSL script on it. In th Python script, this looks something like:
os.chdir(sJMPLoc) // move to the JMP install dir
subprocess.Popen(sCmdOpen) // execute the command to open the CSV file in JMP
subprocess.Popen(sCmdScript) // execute the command to run the JSL script
In the JSL:
dt = Current Data Table();
dt << Save();
This didn't appear to work, so I started digging to see where it thought the file was stored and added this to my script:
dir = dt << getpath;
show(dir);
Results of that:
dir = "POWER_CORRELATIONS_YESTERDAY_09_08_15__15_36_57.jmp";
Turns out JMP is converting the .CSV into a .JMP file and storing it in some temp directory, or at least the dt << getpath function isn't aware of the original path.
How can I get the path to the CSV where the CSV was when it was opened?
Thanks,
Chip
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Every time the Python script runs, it creates a new directory for the data and all reports for it. If I could get our database tools to save the file as a JMP file, this would all be easy as JMP retains the path to JMP files:
/*:
//:*/
dt = Current Data Table();
show(dt << getpath);
/*:
dt << getpath = "C:\Users\cpwood\Documents\correlationData\power_54W_ww32p1_working.jmp";
The same cannot be said about CSVs:
/*:
//:*/
dt = Current Data Table();
show(dt << getpath);
/*:
dt << getpath = "POWER_CORRELATIONS_YESTERDAY_09_04_15__15_36_57.jmp";
The POWER_CORRELATIONS_YESTERDAY... file was a CSV when opened, but JMP appears to immediately convert it to a JMP file (reasonably so) and ditch the path for some odd reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am running into the same issue. The reason I did not write the path into the code is because I am trying to automate the process so that the script find the path and then saves a JMP plot in the folder that had the original csv file. I am also having the issue that JMP loses the path that I selected and instead selects the path that points to the script file folder, not the csv file folder...