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
 All Forums
 Origin Forum for Programming
 Forum for Python
 External IPython crashes on second run

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dejavu_walnut Posted - 11/17/2020 : 12:21:10 AM
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?
5   L A T E S T    R E P L I E S    (Newest First)
Chris D Posted - 11/19/2020 : 08:41:20 AM
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
dejavu_walnut Posted - 11/19/2020 : 05:05:59 AM
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
Chris D Posted - 11/18/2020 : 10:11:10 AM
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
Chris D Posted - 11/17/2020 : 11:39:25 AM
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
Chris D Posted - 11/17/2020 : 09:44:21 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000