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
 WBook.add_sheet() returns error set.

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
i.reuter Posted - 10/06/2020 : 10:58:16 AM
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?
5   L A T E S T    R E P L I E S    (Newest First)
AmandaJansen Posted - 07/20/2023 : 03:47:21 AM
Thanks, my issue has been fixed.

Amanda Jansen
Chris D Posted - 10/19/2020 : 08:38:07 AM
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
todd_23 Posted - 10/16/2020 : 5:11:54 PM
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/
i.reuter Posted - 10/07/2020 : 03:14:44 AM
Hi Chris,

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

Best
Ingo
Chris D Posted - 10/06/2020 : 12:26:32 PM
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

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