Error when execute webprinting Nicelabel 2019

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
chngme1
Newcomer
Posts: 4
Joined: Fri Nov 29, 2019 7:20 am

Error when execute webprinting Nicelabel 2019

Post by chngme1 » Fri Nov 29, 2019 9:24 am

Dear Sirs,

My company recently upgraded Nicelabel 6 to Nicelabel 2019, we also re-imported Nicelabel 6 solution file (Form) into Nicelabel 2019 without any syntax error (shown in Nicelabel 2019 designer). When we try to perform testing in designer, Nicelabel 2019 shown name '_loopVar' is not defined (Refer to screenshot1.jpg).

screenshot2,jpg to show execution log.
screenshot3.jpg to show script that have this variable.
screenshot4.jpg to show we have define this variable.

Anyone have same problem ? if you upgrade from Nicelabel 6 to Nicelabel 2019 ?

Thanks in advance.
Min.
Attachments
screenshot4.jpg
screenshot4.jpg (128.04 KiB) Viewed 109 times
screenshot2.jpg
screenshot2.jpg (76.25 KiB) Viewed 109 times
screenshot1.jpg
screenshot1.jpg (56.57 KiB) Viewed 109 times
screenshot3.jpg
screenshot3.jpg (201.66 KiB) Viewed 109 times

User avatar
Mytch
NiceLabel Support
NiceLabel Support
Posts: 103
Joined: Fri Jul 13, 2018 10:26 pm
Location: Milwaukee, Wisconsin
Contact:

Re: Error when execute webprinting Nicelabel 2019

Post by Mytch » Tue Dec 03, 2019 10:45 pm

chngme1,

I don't know exactly why or how this worked in NiceLabel 6 (we switched to IronPython in 2017/2019). But you shouldn't even need to cast that _loopVar variable as an int inside the splitlines method. Below seems to work:

Code: Select all

dbrow = sqlQuery.Value.splitlines(_loopVar.Value)
Can you tell me if these resolves your issue?

Regards,
Mytch

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2973
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: Error when execute webprinting Nicelabel 2019

Post by Saso » Wed Dec 04, 2019 11:57 am

Additionally to what Mytch said also upgrade to the latest version of NiceLabel 2019.
We just released 2019.2.0.5339 yesterday. It fixes some problems referencing the variables in Python scripts and conditions.

Download here.
If you already have NiceLabel 2019, this will be in-place upgrade, keeping all files and settings.
Saso Fleiser
Senior Technical Product Specialist

chngme1
Newcomer
Posts: 4
Joined: Fri Nov 29, 2019 7:20 am

Re: Error when execute webprinting Nicelabel 2019

Post by chngme1 » Thu Dec 05, 2019 3:44 am

Mytch wrote:
Tue Dec 03, 2019 10:45 pm
chngme1,

I don't know exactly why or how this worked in NiceLabel 6 (we switched to IronPython in 2017/2019). But you shouldn't even need to cast that _loopVar variable as an int inside the splitlines method. Below seems to work:

Code: Select all

dbrow = sqlQuery.Value.splitlines(_loopVar.Value)
Can you tell me if these resolves your issue?

Regards,
Mytch
Hi Mytch,

Thanks for your suggestion, after I removed the int function, this error do not exist anymore but now another error appear again. (please see attached screenshot5). Not too sure is due to the error function not inside the method or other error.

Thanks.
Chngme1.
Attachments
screenshot6.jpg
screenshot6.jpg (218.46 KiB) Viewed 68 times
screenshot5.jpg
screenshot5.jpg (48.7 KiB) Viewed 68 times

chngme1
Newcomer
Posts: 4
Joined: Fri Nov 29, 2019 7:20 am

Re: Error when execute webprinting Nicelabel 2019

Post by chngme1 » Thu Dec 05, 2019 3:50 am

Saso wrote:
Wed Dec 04, 2019 11:57 am
Additionally to what Mytch said also upgrade to the latest version of NiceLabel 2019.
We just released 2019.2.0.5339 yesterday. It fixes some problems referencing the variables in Python scripts and conditions.

Download here.
If you already have NiceLabel 2019, this will be in-place upgrade, keeping all files and settings.
Hi,

I am not able to access the url that given by you, any other url that can access by public user ?

Regards,
Chngme1.

User avatar
Mytch
NiceLabel Support
NiceLabel Support
Posts: 103
Joined: Fri Jul 13, 2018 10:26 pm
Location: Milwaukee, Wisconsin
Contact:

Re: Error when execute webprinting Nicelabel 2019

Post by Mytch » Thu Dec 05, 2019 5:07 pm

chndme1,

Firstly, you can try to download NiceLabel 2019.2 from here instead:
http://ftp.nicelabel.com/software/demo/ ... el2019.exe

Let me know if that does not work. Although, I did already test your code in 19.2 and had same issue when trying to use the int function like that. Issue is not related to variable name or int function itself, but rather the usage of parentheses and brackets like sql.Value.splitlines([int(variable.Value)]). Not sure why this causes a problem, but I tried just with all parentheses and it's fine. Most efficient option is to just not cast at all, because it's not needed in this context.

As far as the new error, I don't really know what your incoming data looks like. I can tell you all NiceLabel variables are considered strings. The error you get is implying variable dbRow is a list instead of a string, therefore cannot use split. You can cast as string, of course, like:

Code: Select all

dbFields = str(dbRow).split(',')
This syntax doesn't really make sense because you take value of "sqlQuery", which is just some string, then you turn it into a list with splitlines. Then you save that list into dbRow and try to split it and save to dbFields. But as you can see, you can't use split on a list like that, only a string. Not sure if dbRow is used as list type somewhere else. Are you sure this worked in v6 just like this? There's probably a better way to handle this, so I recommend you review syntax and understand incoming data vs desired output.

Regards,
Mytch

chngme1
Newcomer
Posts: 4
Joined: Fri Nov 29, 2019 7:20 am

Re: Error when execute webprinting Nicelabel 2019

Post by chngme1 » Mon Dec 09, 2019 9:42 am

Hi Mytch,

Thanks for the advise, I will review this code and change necessary statement.

Thanks,
Chngme1.

Post Reply