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
 WBook.add_sheet() returns error set.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

i.reuter

12 Posts

Posted - 10/06/2020 :  10:58:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

there seems to be an issue with the add_sheet(..) method on WBooks.

I've tried to add a new sheet to an existing Workbook and ended with the same error in python every time. This is my code (simplified):

import originpro as op

po = op.po
po.Visible = 1

x_vals = [1,2,3,4,5,6,7,8,9,10]
y_vals = [23,45,78,133,178,199,234,278,341,400]

wks = op.new_sheet('w', 'First Dataset')
#
wks.name = 'Long Sheet Name'
wks.from_list(0, x_vals, 'X Values')
wks.from_list(1, y_vals, 'Y Values')
#
wks2 = op.new_sheet('w', '2nd Dataset')
wks2.name='Long Name of 2nd Sheet'
wks2.from_list(0, x_vals, 'X')
wks2.from_list(1, y_vals, 'Y')
wks3 = wks2.get_book().add_sheet('Additional Sheet on 2nd Dataset', active=True)


After code execution all Sheets are created as intended but the last one is not 'active'.

Python returns this error message:
quote:

RuntimeError: Exception in OriginExt OriginObject::SetNumProp

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/Users/xxxxxxxxxx/PycharmProjects/OriginConnection/main.py", line 20, in <module>
wks3 = wks2.get_book().add_sheet('Additional Sheet on 2nd Dataset', active=True)
File "C:\Users\xxxxxxxxxx\.conda\envs\origin\lib\site-packages\originpro\worksheet.py", line 710, in add_sheet
return WSheet(self._add_sheet(name, active))
File "C:\Users\xxxxxxxxxx\.conda\envs\origin\lib\site-packages\originpro\base.py", line 196, in _add_sheet
self.set_int("active", obj1.GetIndex()+1)
File "C:\Users\xxxxxxxxxx\.conda\envs\origin\lib\site-packages\originpro\base.py", line 40, in set_int
self.obj.SetNumProp(prop, int(value))
File "C:\Users\xxxxxxxxxx\.conda\envs\origin\lib\site-packages\OriginExt\OriginExt.py", line 715, in SetNumProp
return _OriginExt.OriginObject_SetNumProp(self, strVarName, dVal)
SystemError: <built-in function OriginObject_SetNumProp> returned a result with an error set



I'm working with Python 3.7.9 and Origin 9.7.5.184.

Can anyone confirm this behavior?

Chris D

428 Posts

Posted - 10/06/2020 :  12:26:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I can see the issue when Origin 2020b is used. Our recent improvements in this area (e.g. the originpro package) have been focused on the very soon to be released Origin 2021 and are compatible only with 2021. The code runs fine in 2021.

Can you send us an email to tech@originlab.com, mentioning this post and we can discuss further.

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

i.reuter

12 Posts

Posted - 10/07/2020 :  03:14:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Chris,

thanks for clarification that Origin 2021 is required. I've reached out to you by mail.

Best
Ingo
Go to Top of Page

todd_23

United Kingdom
2 Posts

Posted - 10/16/2020 :  5:11:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have tried to run your code on Jupyterlab and it's working flawlessly although I'm still using Origin 2020b. I don't know if it makes any sense but does the compilers update versions automatically? I'm traveling right now and will try it once again once I reach my flat in Greece https://tranio.com/greece/attica/athens/
Go to Top of Page

Chris D

428 Posts

Posted - 10/19/2020 :  08:38:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Okay, Thanks.
Tough the code may run in 2020b, we will only support Origin 2021 and later. 2021 will be released very soon.

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

AmandaJansen

USA
1 Posts

Posted - 07/20/2023 :  03:47:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, my issue has been fixed.

Amanda Jansen
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