The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 External IPython crashes on second run
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dejavu_walnut

2 Posts

Posted - 11/17/2020 :  12:21:10 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2021
Operating System: Windows 10 1909/2004

I was trying to run the sample code #1 for external python on https://www.originlab.com/doc/ExternalPython/External-Python-Code-Samples
My Python (virtual) environment: Miniconda (conda 4.5.12) + python 3.8.5 + IPython 4.19.0 + Spyder 4.15 + Jupyter Notebook 6.1.5
So both Spyder and Jupyter Notebook are powered by IPython core. Soon I noticed that the sample code run properly on first run after ipython launches, but fails from second run with the following log:


Traceback (most recent call last):

File "C:\myPython\scipyplot\pyoriginext_test.py", line 28, in <module>
op.set_show(True)

File "C:\Anaconda3\envs\py385\lib\site-packages\originpro\utils.py", line 107, in set_show
set_lt_var("@VIS", val)

File "C:\Anaconda3\envs\py385\lib\site-packages\originpro\utils.py", line 84, in set_lt_var
po.LT_set_var(name, value)

File "C:\Anaconda3\envs\py385\lib\site-packages\OriginExt\OriginExt.py", line 2726, in LT_set_var
return _OriginExt.ApplicationBase_LT_set_var(self, lpcszVar, dValue)

SystemError: <built-in function ApplicationBase_LT_set_var> returned a result with an error set



Restart another ipython core would be fine again for the first run. Any idea what may cause this issue?

Chris D

428 Posts

Posted - 11/17/2020 :  09:44:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I see the error too and will attempt to resolve it. I'll report back as soon as I have a solution.

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

Chris D

428 Posts

Posted - 11/17/2020 :  11:39:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The issues seems to be:
1. IPython caches imported modules and doesn't re-import them when a script is run a second time with same core.
2. The originpro packages initializes the instance of Origin (via the underlying OriginExt module) when it is imported.
3. The call to op.exit() at the end of the script shuts down Origin.

So, when the script is run a second time, Origin is never launched and thus the error. If you remove the call to op.exit(), you can see Origin stays open and works properly when scripts are run multiple times. But this isn't a very good solution at all.

IPython's magic to re-import a module doesn't seem to work properly with the originpro or OriginExt module for some reason.

I'll have to escalate this up to the developer to address.

It is good that you came upon this early so we can address it. I work with VS Code and have seen no such issues. Nor have I seen such issues when running the script from the Windows Command Prompt.

If you ping me at tech@originlab.com, I can let you know what the developer says (I'll also post it here).


Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

Chris D

428 Posts

Posted - 11/18/2020 :  10:11:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Update:

This issue has been fixed and will be released as originpro version >= 1.0.3 as soon as testing is complete.



Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

dejavu_walnut

2 Posts

Posted - 11/19/2020 :  05:05:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much for the incredibly quick response!

I'm just an amateur coder and was trying to batch import my experimental data then plot it with Origin leaving the risk of messing up tens to hundreds of data. Spyder was shipped with Anaconda and need no extra plugins, so it would be pleasant to stick with it for me.
Looking forward to the fix and go on coding with Spyder lol
Go to Top of Page

Chris D

428 Posts

Posted - 11/19/2020 :  08:41:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Email tech@originlab.com and I'll send you the wheel file unless the new version (> 1.0.2) has been released by the time you read this.


Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000