cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Ole_Luehn
Level III

How to change the path for saving / opening file in JMP 19 / Python script

Dear,

I run the following script in JMP19 and now in the file the script gets stuck at the bold line below. 

The table results.json is on my desk-top. I tried to copy the file and path to a different storage location. 

It still gets stuck.

In JMP 19 the script was working as it is...

Do you now how to change it?

I think that I need to tell the script to save the file into the Python path in the JMP19 folder on my, computer,....maybe?


with open("results.json", "w+") ......

Best wishes,
Ole

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to change the path for saving / opening file in JMP 19 / Python script

A little clarification please. You indicate the script now gets stuck in JMP 19, further down you indicate, in JMP 19 the script was working as is...?   I'm assuming you mean it hangs in JMP 19 but was working in 18?  Always helpful to have the full version numbers since we do make security and bug fix releases such as 19.0.1.

What is supposed to happen, is that the file would be saved to the same directory as the JSL script.  Running the JSL script would set the current working directory to the location of the jsl script, and without additional path components on the Python open() would default to saving in the same directory as the JSL.  If your JSL isn't pulling further JSL files as includes, you could even use Python commands to change the current working directory. 

On the Python side of things you can easily specify the full path to the file, including use of special directories.  

import jmp
import os

...

# using os.path.join() makes path portable on macOS and Windows on_desktop = os.path.join( jmp.DESKTOP, 'results.json') with open( on_desktop, 'w+' as f: f.write( str(response.primary_results[0])) ..

View solution in original post

3 REPLIES 3
Ole_Luehn
Level III

Re: How to change the path for saving / opening file in JMP 19 / Python script

Sorry. I meant in JMP 18 it was working... 

Re: How to change the path for saving / opening file in JMP 19 / Python script

A little clarification please. You indicate the script now gets stuck in JMP 19, further down you indicate, in JMP 19 the script was working as is...?   I'm assuming you mean it hangs in JMP 19 but was working in 18?  Always helpful to have the full version numbers since we do make security and bug fix releases such as 19.0.1.

What is supposed to happen, is that the file would be saved to the same directory as the JSL script.  Running the JSL script would set the current working directory to the location of the jsl script, and without additional path components on the Python open() would default to saving in the same directory as the JSL.  If your JSL isn't pulling further JSL files as includes, you could even use Python commands to change the current working directory. 

On the Python side of things you can easily specify the full path to the file, including use of special directories.  

import jmp
import os

...

# using os.path.join() makes path portable on macOS and Windows on_desktop = os.path.join( jmp.DESKTOP, 'results.json') with open( on_desktop, 'w+' as f: f.write( str(response.primary_results[0])) ..
Ole_Luehn
Level III

Re: How to change the path for saving / opening file in JMP 19 / Python script

Dear Paul.
Yes, thank you, your assumptions were right. indeed I had the JMP 19.0.1 version and needed to change the path for the saving of the files. 
That helped. In my "old" 18 version, that was not the case (not needed).
Thank you! 

 

Recommended Articles