I want to read data using sikuli and Python.

Asked 2 years ago, Updated 2 years ago, 26 views

I've never touched a program before, so I'm going to create it.
We are at a standstill.
I'm a complete beginner, so please let me know if I can't do it.

Environment
Windows 10 office2016
SikuliIDE 1.1.1

What you want to do
As Excel files are updated over time, the data is read in Python each time.
I'd like to turn it around with for and do the case-by-case work while using the if function.

Processed by Python
If column B is blank → pass
If column B is "Confirmed" → Check if column C is listed
Copy alphanumeric characters in column B if not listed

Enter a description of the image here

import sys
import xlwt
import xlrd
reload(sys)
sys.setdefaultencoding('utf-8')
FILEDIR=u"C:\\Users\\xxxxxx\\Desktop\\test\\"
FILENAME_R=u "ExcelDataSample.xlsx"
FILENAME_W1 = u "ExcelDataSample_w1.xls"
FILENAME_W2 = u "ExcelDataSample_w2.xls"
book_r=xlrd.open_workbook('C:\\Users\\xxxxxxxx\Desktop\\xlsx')
sheet1 = book_r.sheet_by_index(0)
print(book_r.nsheets)
print(sheet1.nrows)
print(sheet1.ncols)
print('---------------------------')
min_row = 1
max_row = 4
min_col=1
max_col = 4
for num in range (min_row, max_row+1):
 data=sheet1.cell(num,1).value
if data is None:
 pass
if data is confirmed:
 for num in range (min_row, max_row+1):
  data2 = sheet1.cell(num,2).value
   if data2 is None:
       data3 = sheet1.cell(num,0).value 
        print(data3)

That's all.

The error is shown below, but
There is no full-width input, and there is no error line in the left column of sikuli

[error] Error caused by:java.lang.IllegalArgumentException:Cannot create PyString with non-byte value

Before "if data is verified:" we proceeded with no errors or anything.
However, since there are no detailed errors,
I don't know what's wrong.

Thank you for your cooperation.

python

2022-09-30 10:41

1 Answers

The next line is grammatically incorrect, so

if data is confirmed

Try correcting it as follows

if data=='Confirmed':

I think I'm using Python 2, so if that doesn't work, I'll try the following:

if data==u 'Confirmed':


2022-09-30 10:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.