Subscribe Bookmark RSS Feed

Script to fully 'clean' JMP of all variables/namespaces/etc to match freshly started program

nathan-clark

Community Trekker

Joined:

Sep 27, 2016

I have a script that I'm troubleshooting and the issue(s) deal with scoping. The problem is that I have to completely shut down JMP and restart it to test my changes ( deletesymbols() and deletenamespaces() don't clean things up enough).

 

1) Start JMP

2) Run script, get error

3) Close data tables

4) Run script again, script works fine.

5) Close JMP then restart JMP

6) Run script, get error

 

Clearly something is declared, in place, assigned, etc that allows the script to work on the 2nd time. I'd like some script to pretty much clear whatever JMP has going on so it's about as fresh as possible (just like a full restart of the program).

 

Thanks!

5 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

what is the error you are getting.  Can you please look in your log and include that in your response?

Jim
nathan-clark

Community Trekker

Joined:

Sep 27, 2016

There are a bunch of them (variable, namespace assignment, etc) and not worth bringing up here. All I'm looking for is a script that will completely clean all variables, namespaces, globals, cache, etc. so the state is as clean as an intial start. I know the reason(s) the script isn't working ... i just dont want to completely restart JMP every time I want to test.

ian_jmp

Staff

Joined:

Jun 23, 2011

From 'Help > Scripting Index' -  'Delete Symbols()' will 'delete all symbols in any and all scopes. If one or more names are specified, only those symbols are deleted.'

nathan-clark

Community Trekker

Joined:

Sep 27, 2016

Sadly, DeleteSymbols() doesn't work. Much like your response I believe it should have worked. I may need to contact JMP support. Perhaps DeleteSymobols() isn't doing what it should be doing?

nathan-clark

Community Trekker

Joined:

Sep 27, 2016

Thanks to everyone's comments... I figured out what the problem was and why Deletesymbols() wasn't working.

 

It turns out that one part of my scripts turned on the Here namespaces (Names default to here(1)) ... being part of an include made the whole batch of scripts in the Here namespace which didn't work with other scoping I had done. Deletesymbols() didn't work because the variables I needed to delete were actually stored in the Here namespace now, and protected.

 

I was able to fix this by forcing the Here namespace to go away at the start of my 1st script so when it was brought back by the 2nd script all the failures would occur on demand.

 

In the very end, the two scripts came from different sources and a lot of scoping work needed to be done to get everything working again. But I now know more about how the Here namespace can be a blessing and a curse :-D