Re: [Sikuli-driver] [Question #678681]: Sikuli 1.1.3: Is it possible to trap syntax errors?

2019-02-22 Thread Ron Turrentine
Question #678681 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/678681

Ron Turrentine posted a new comment:
RaiMan, thanks I will do some testing of the return code on the executed
script.  That may just be the key to this whole thing.  I'll let you
know what I discover!

Best regards,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #678681]: Sikuli 1.1.3: Is it possible to trap syntax errors?

2019-02-21 Thread Ron Turrentine
Question #678681 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/678681

Status: Needs information => Open

Ron Turrentine gave more information on the question:
RaiMan,

Thanks for replying!

Here are the relevant lines from my script.
This is a FOR loop which loops through the scripts that are returned by my 
database query.
Each script is executed by the "execfile" line.
This is ran within a try-except block.  If an exception is through, it logs the 
error and exits the script.
If you need to see the rest of the script, too, please just let me know!

---

# iterate through scripts in array and run each one in succession
for sn in range(len(scriptnames)):


if os.path.exists(scriptnames[sn]):
# Point to where the scripts images are stored
setBundlePath(scriptnames[sn])

# Grab base Sikuli filename
basename = os.path.splitext(os.path.basename(scriptnames[sn]))[0]

#Write line to log file
line = str(datetime.datetime.now()) +  ": Processing script = " + 
scriptnames[sn] + "\n"
WriteToPDALog(pda_errorlog, line)

# Get name of relative Python script in Sikuli folder
pyname = basename + ".py"

joinedname = os.path.join(scriptnames[sn], pyname)

#Execute the current script:
retcode = execfile(joinedname)

#Write metrics & "completed" info to log file
line  = str(datetime.datetime.now()) +  ": Captured " + 
str(myPDA.Screenshots) + " screenshots; recorded " + str(myPDA.Errors) + " 
errors; downloaded " + str(myPDA.DLFiles) + " files; split " + 
str(myPDA.WSSplit) + " worksheets.\n"
line += str(datetime.datetime.now()) +  ": Completed processing " + 
basename + "script.\n"
line += str(datetime.datetime.now()) +  ": 
**\n"

WriteToPDALog(pda_errorlog, line)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #678681]: Sikuli 1.1.3: Is it possible to trap syntax errors?

2019-02-20 Thread Ron Turrentine
New question #678681 on Sikuli:
https://answers.launchpad.net/sikuli/+question/678681

Hello fellow Sikulians!

At first glance you may be laughing at this subject line and wondering what 
I've been smoking.  
However  I actually have a novel case that I could use some help with!  Let me 
explain...

I have a Sikuli "Control Script" that launches each night on a VM via Windows 
Task Scheduler.  The script grabs a list of eligible Sikuli scripts from a SQL 
database to process (there are presently 50 in total, and the number is 
growing). Each script is then executed individually by the Control Script, 
one-by-one, and their run results are recorded into our SQL database.   

If a script being ran has an error, then that error is trapped and recorded 
into a log file, then the Control Script moves onto the next script. However, 
if a script has a *syntax* error, then it halts the Control Script's execution 
completely and no further scripts are processed.

If possible, I need to figure out a way for my Control Script to determine if a 
syntax error has occurred in a script.  Then, if it has, the script can ignore 
it, record the results, and move onto the next script.  

Any help/suggestions are encouraged & appreciated!

Thanks,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-11-26 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Status: Answered => Open

Ron Turrentine is still having a problem:
Raiman,

Unfortunately, no. I had to completely removed the logic which attempted to 
delete the file.
If anyone else discovers a way to do this, I would appreciate that they share 
their code.

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #675371]: Sikuli 1.1.3: How to display the code of the line which threw the error.

2018-10-19 Thread Ron Turrentine
New question #675371 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675371

In a script that I wrote, I have exception handling which logs the error 
information for review later. I would like to include the actual code that is 
located on the line which threw the error.  Is there an efficient way of doing 
that? I have tried opening up the actual .PY file and pulling the line # which 
errored from it, but that is not working well (getting an maximum recursion 
depth error when I do). Is there a better way?

I appreciate any recommendations!

Thanks,

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675229]: Sikuli 1.1.3: How to derive name of script?

2018-10-15 Thread Ron Turrentine
Question #675229 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675229

Status: Open => Solved

Ron Turrentine confirmed that the question is solved:
I figured it out!  I realized that I could use "getBundlePath()" within
the child scripts to pull back the current script name.

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675229]: Sikuli 1.1.3: How to derive name of script?

2018-10-15 Thread Ron Turrentine
Question #675229 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675229

Description changed to:
I have developed a "Control" script which processes a list of Sikuli
scripts that it pulls from a SQL database. It does this by using the
"setBundlePath" and "execfile" commands for each script in the list,
running the .py file for each one.

My challenge is that I need to derive the currently-running script name
from within the running script itself (not from within the Control
script). I have tried using the sys.argv[0] system variable, but it
always returns the name of the control script, which is the parent
script. I need to pull the name of the running script (child script),
though.

Is there a simple way (hopefully a system variable) that holds this
information dynamically during runtime?

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675229]: Sikuli 1.1.3: How to derive name of script?

2018-10-15 Thread Ron Turrentine
Question #675229 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675229

Description changed to:
I have developed a "Control" script which processes a list of Sikuli
scripts that it pulls from a SQL database. It does this by using the
"setBundlePath" and "execfile" commands for each script in the list,
running the .py file for each one.

My challenge is that I need to derive the currently-running script name
from within the running script itself (not from within the Control
script). I have tried using the sys.arg[0] system variable, but it
always returns the name of the control script, which is the parent
script. I need to pull the name of the running script (child script),
though.

Is there a simple way (hopefully a system variable) that holds this
information dynamically during runtime?

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #675229]: Sikuli 1.1.3: How to derive name of script?

2018-10-15 Thread Ron Turrentine
New question #675229 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675229

I have developed a "Control" script which processes a list of Sikuli scripts 
that it pulls from a SQL database.
It does this by using the "setBundlePath" and "execfile" commands for each 
script in the list, running the .py file for each one.

My challenge is that I need to derive the currently-running script name from 
within the running script itself (not from within the Control script). I have 
tried using the sys.arg[0] system variable, but it always returns the name of 
the control script, which is the parent script. I need to pull the name of the 
running script (child script), though.

Is there a simple way (hopefully a system variable) that holds this information 
dynamically during runtime?

Thanks!

Ron Turrentine




-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-08 Thread Ron Turrentine
Question #674676 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674676

Ron Turrentine posted a new comment:
Raiman,

I downloaded the JAR through my mobile hotspot here at work and tested
it with a user who hasn't installed Sikuli yet. It worked perfectly!

You are THE MAN! Thank you!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-08 Thread Ron Turrentine
Question #674676 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674676

Ron Turrentine posted a new comment:
Thanks Raiman!

I'll see about downloading it tonight (Dropbox is also blocked here at
work). :(

I sincerely appreciate your support!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-08 Thread Ron Turrentine
Question #674676 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674676

Ron Turrentine posted a new comment:
Hey Raiman,

I tried 1.1.4 a couple of months ago, but there were a couple of bugs
that made me switch back to 1.1.3 until it was stabilized. Since then, I
have developed a class framework for our users to utilize in scripting.
Also, the removal of the clickable function menu from the left -pane of
the IDE was something that we definitely need (especially for our users
- the visual menu is greatly helpful).

This will be installed on Windows 7 and 10 systems.

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-08 Thread Ron Turrentine
Question #674676 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674676

Ron Turrentine posted a new comment:
Hey Raiman,

I tried the offline setup JAR that was in the link above, but it was not
successful.  I'm sure that I'm likely doing something wrong.  To be
frank, the instructions on how to do it were quite unclear for me.

Is there not one, single installation file that includes all of the
files needed to install Sikuli? Or are there multiple files needed?
Step-by-step instructions (like 1. Do this, then 2. Click this, then 3.
Do this thing) would be fantastic.

Tomorrow I will have a classroom of 10 people that I have been tasked
with helping to download, setup & install Sikuli. I will also be giving
them some *very* basic training. Since I cannot get the offline
installer to work, and since the download site is blocked here, we will
have to do this through a mobile hotspot, which is painfully slow. I
know it's better than nothing, though.

I am attempting to get the SIkuli download URL "unblocked" here at my
place of employment (which will take congressional approval after
something not unlike the Kavanaugh hearings)  so any help is GREATLY
appreciated!

Thanks in advance!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-04 Thread Ron Turrentine
Question #674676 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674676

Status: Answered => Solved

Ron Turrentine confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #674676]: Sikuli 1.1.3: Offline Installation JAR?

2018-10-04 Thread Ron Turrentine
New question #674676 on Sikuli:
https://answers.launchpad.net/sikuli/+question/674676

Raiman,

Is there an offline installer available for 1.1.3 that does not attempt to 
connect to the web to download files?
Our corporate firewall blocks your site, so the web installer does not work.  
If an offline setup JAR was available, where everything was included locally, 
it would be optimal for installation!

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-10 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
Good information, Raiman.  Thanks for the tip.

I'll definitely test this out this week and report back.

Best regards,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-07 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
Hey Raiman,

Thanks for the reply!  Yes, I am using the bundled XLRD.  I have not d/l
or installed it externally.

BTW, I downloaded the sysintertals "handle.exe" from technet.
It helped me to determine that it is java.exe that has a firm grip on the Excel 
file. 
Oddly, Java.exe actually had 4 separate holds onto the file:
https://i.imgur.com/B2UlMXO.png

Apparently I can forcibly "unlock" the grip on the file using
handle.exe, but I hesitate doing it with such brute force. I'd much
rather do it in a more "elegant" fashion.

I really appreciate everyone's patience & help with this.

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-07 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
I finally found the culprit to the issue by using subprocess.Popen.  It
returned a much more useful error than os.remove did.

The error it is returning is: "The process cannot access the file
becaus4e it is being used by another process."

This makes me believe that the XLRD "release_resources" method for the
workbook is not really truly releasing the workbook from memory to allow
me to delete it.

Any other suggestions on how I can clear the workbook from memory in
order to successfully delete it?

Ron

PS: Here's my working function using Popen that finally helped me see
the issue:

def DelFile(self):
from subprocess import Popen, PIPE, STDOUT

try:

command = "cmd.exe /c del /f \"" + self.NewFile + "\""

output = Popen(command, stderr=PIPE)

ret = output.communicate()

if ret:
raise StandardError(str(ret[1]))

except:
   
exc_type, exc_val, exc_tb = sys.exc_info()

ErrorText = "* ERROR IN SCRIPTNAME = " + sys.argv[0] + " 
*\n"
ErrorText += "Date/Time  : " + str(datetime.datetime.now()) + "\n"
ErrorText += "Host name  : " + socket.getfqdn() + "\n"
ErrorText += "User name  : " + getpass.getuser() + "\n"
ErrorText += "Line Number: " + str(exc_tb.tb_lineno) + "\n"
ErrorText += "Error Type : " + exc_type.__name__ + "\n"
ErrorText += "Error Value: " + str(exc_val.message) + "\n"
ErrorText += 
"***\n\r"

print ErrorText

self.LogError()

###

And here is the output:

* ERROR IN SCRIPTNAME = //corpDpt02/CHMShare/Testing_Services/Automation 
Comparison/Sikuli Scripts/SurgCancDownloadOnly.sikuli *
Date/Time : 2018-09-07 09:09:55.462000
Host name : CORPBYE8557A.hca.corpad.net
User name : BYE8557
Line Number: 66
Error Type : StandardError
Error Value: The process cannot access the file because it is being used by 
another process. 

***

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-06 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
I think I may have found a clue as to the possible root cause of my
issue.

I tried deleting the file using the subprocess library.  I tried it with
both the "Popen" And "call" methods.  Both failed, giving me an error of
"OSError: [Errno 2] No such file or directory ".  Both the file &
directory indeed exist.

So I decided to try a simple "dir" command on the directory in question.
It also returned a "No such file or directory" error.

Intrigued, I decided to simplify my test.  I ran the following script to
run a simple "dir" command at the root of my C: drive (the script
follows this post). It also returned a "No such file or directory" error
(see the notes following the script for the verbose error returned by
Sikuli).

Am I running this command with the correct syntax? Or is there possibly
a problem with the subprocess on Windows 10?

Raiman, would love to hear your input on this.

Thanks,

Ron



import subprocess

ret = subprocess.Popen(["dir","c:\\"],
stdout=subprocess.PIPE).communicate()

print ret

###

[error] script [ TestPopen ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File 
"\\corpDpt02\CHMShare\Testing_Services\Automation Comparison\Sikuli 
Scripts\TestPopen.sikuli\TestPopen.py", line 3, in  ret = 
subprocess.Popen(["dir","c:\\"], stdout=subprocess.PIPE).communicate() File 
"C:\Users\bye8557\AppData\Roaming\Sikulix\Lib\subprocess.py", line 859, in 
__init__ self._execute_child(args, executable, preexec_fn, close_fds, File 
"C:\Users\bye8557\AppData\Roaming\Sikulix\Lib\subprocess.py", line 1369, in 
_execute_child raise OSError(errno.ENOENT, os.strerror(errno.ENOENT)) OSError: 
[Errno 2] No such file or directory

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-06 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
Manfred,

Thanks so much! I actually tried something similar by using "os.system".  
Namely:  os.system(" del /f " + ws_to_split). It was not successful, but I have 
not tried it with the run command.  I will definitely give that a go this 
morning and then report back on how it goes.

Thanks again!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-05 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine gave more information on the question:
Here is a rather humorous solution, but it works:

My script opens an explorer window to the folder where my Excel file
lies (using subprocess.Popen), then finds the Excel icon, right clicks
on it, then clicks "Delete".

This is more Sikuli-esque than Pythonic, but at the moment I can't think
of any other way. :-/

You can view a screenshot of the script here:
https://imgur.com/a/1YZSH45

I'd rather use os.remove, though, if I can figure out how to get it to
work.

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-05 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Status: Answered => Open

Ron Turrentine is still having a problem:
Thanks for you reply Manfred!

I actually found that same suggestion and tried it.  
And you are correct, it made no noticeable difference. It's a very strange 
problem!

If the workbook were the only  file in the folder, I would simply try removing 
the directory and it's contents altogether.  
However, there are valuable files inside the directory that I must preserve. 

Thanks again,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-05 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Status: Answered => Open

Ron Turrentine is still having a problem:
I'm still struggling with this issue.  If someone out there has
experience with opening XLRD manipulated workbooks in Windows, and then
deleting them, I would appreciate your input.

Although I am calling "release_resources" before attempting the file
deletion, it appears that the script is still holding tight to the file
in memory.  From what I can tell  from reading the XLRD documentation,
that method is the only way to remove the file from memory (other than
the script itself ending).

Thanks in advance!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673348]: using xlrd: Error attempting to delete file after wb.release_resources()

2018-09-05 Thread Ron Turrentine
Question #673348 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673348

Ron Turrentine posted a new comment:
Thanks Raiman.  I'm going "back to the drawing board" and will doing a
bit more research on the proper way to "close" the workbook in xlrd
then. From what I've read, "release resources" was *supposed* to do the
trick, but it obviously is not releasing the file properly.

Oh, and thank you for the os.path.join tip.  I will definitely be using
that in my script!

Best,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #673348]: [1.1.3]: Error attempting to delete file

2018-09-04 Thread Ron Turrentine
New question #673348 on Sikuli:
https://answers.launchpad.net/sikuli/+question/673348

OS: Windows 10

This is more of a Jython question that pure Sikuli, but I have not had success 
in finding answers elsewhere.  Hoping that you guys here may be able to help!

My script is attempting to do the following:

1.) Download an Excel workbook (XLSX) 
2.) Move the file from the WIndows "downloads" folder to a shared folder
3.) Split the individual worksheets from the original workbook into their own 
workbooks
4.) Delete the original XLSX file

The error that I am getting is at step #4. It is an error type of "OSError" 
that says this:

"unlink(): an unknown error occurred: C:\screenshots\SS Case Cancellation 
Monthly Report.xlsx"

Note that the worksheet splitting is successful. The only failure is the file 
deletion.

I am using the xlrd library to manipulate the Excel files.  The error always 
occurs on the "os.remove" line.

Here is the portion of my function that is handling the worksheet splits and 
file deletion:

def SplitWorksheets(self):
import xlrd
from xlutils.copy import copy

print "Attempting to split worksheets..."

try:
x = 0
base = os.path.splitext(os.path.basename(self.NewFile))[0]

targetdir = (self.FullPath + "\\" + base) #where you want your new 
files

#print base

if not os.path.exists(targetdir): #makes your new directory
os.makedirs(targetdir)

ws_to_split = self.NewFile

wb = xlrd.open_workbook(ws_to_split, on_demand=True)

for sheet in wb.sheets(): #cycles through each sheet in the workbook
newwb = copy(wb) #makes a temp copy of that book
newwb._Workbook__worksheets = [ worksheet for worksheet in 
newwb._Workbook__worksheets if worksheet.name == sheet.name ] #keeps only 
current sheet
newwb.save(targetdir + "\\" + sheet.name + ".xls") #Saves 
single sheet as a new wb with its sheet name
x += 1

#Closes the workbook, allowing it to be deleted.
wb.release_resources()

wb = None

print "Preparing to delete file: " + self.NewFile
#Delete original file.
os.remove(self.NewFile)

print "Workbook deleted -> " + self.NewFile

self.NewFile = ""

except:
exc_type, exc_val, exc_tb = sys.exc_info()

ErrorText = "* ERROR IN SCRIPTNAME = " + sys.argv[0] + " 
*\n"
ErrorText += "Date/Time  : " + str(datetime.datetime.now()) + "\n"
ErrorText += "Host name  : " + socket.getfqdn() + "\n"
ErrorText += "User name  : " + getpass.getuser() + "\n"
ErrorText += "Line Number: " + str(exc_tb.tb_lineno) + "\n"
ErrorText += "Error Type : " + exc_type.__name__ + "\n"
ErrorText += "Error Value: " + str(exc_val.message) + "\n"
ErrorText += 
"***\n\r"

print ErrorText

self.LogError()

    else:
dpmsg = "=*=*=*=*=* " + str(x) + " Worksheets Split from Workbook 
*=*=*=*=*="

print dpmsg

finally:
sys.exc_clear() 

##

Any help is greatly appreciated!

Best regards,

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673054]: SikuliX 1.1.4: "System.out is broken" fatal error

2018-08-30 Thread Ron Turrentine
Question #673054 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673054

Ron Turrentine posted a new comment:
Thanks Raiman. I've since found that this "Fatal Error" is being thrown
in 1.1.3 as well.

This may be due to the fact that I'm now using Windows 10 (a corporate wide 
upgrade, unavoidable).
I never saw this behavior in Windows 7.

Best regards,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673054]: SikuliX 1.1.4: "System.out is broken" fatal error

2018-08-29 Thread Ron Turrentine
Question #673054 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673054

Description changed to:
This problem is in Windows 10.

If I press ALT-SHIFT-C to break out of a running script in the 1.1.4
IDE, I receive this fatal error:

"System.out is broken (console output)!
You will not see any message anymore!
Save your work and restart the IDE!"

This happens every time.  Is this a bug, or should I break out a script
differently in 1.1.4?

Here is a link to the screenshot of the error:
https://imgur.com/840b7gz

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673053]: [1.1.4] IDE: load() does not seem to work anymore

2018-08-29 Thread Ron Turrentine
Question #673053 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673053

Ron Turrentine confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673053]: [1.1.4] IDE: load() does not seem to work anymore

2018-08-29 Thread Ron Turrentine
Question #673053 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673053

Status: Answered => Solved

Ron Turrentine confirmed that the question is solved:
Thanks RaiMan! I tested your workaround and it did the trick.

I appreciate the help!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #673054]: SikuliX 1.1.4: "System.out is broken" fatal error

2018-08-28 Thread Ron Turrentine
New question #673054 on Sikuli:
https://answers.launchpad.net/sikuli/+question/673054

This problem is in Windows 10.

If I press ALT-SHIFT-C to break out of a running script in the 1.1.4 IDE, I 
receive this fatal error:

"System.out is broken (console output)!
You will not see any message anymore!
Save your work and restart the IDE!"

This happens every time.  Is this a bug, or should I break out a script 
differently in 1.1.4?

Thanks!

Ron Turrentine


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #673053]: SikuliX 1.1.4: IDE cannot find SQL Driver

2018-08-28 Thread Ron Turrentine
Question #673053 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/673053

Description changed to:
OS: Windows 10
SQL Server:  2012
Utilizing zxJDBC (ziclix)
Driver: Microsoft JDBC driver 7.0 for SQL Server (obtained here):
(https://www.microsoft.com/en-us/download/details.aspx?id=57175)

With the script that I built in SIkuliX 1.1.2, I can successfully connect to 
our SQL Server and insert/update records.
My script also works well in SikuliX 1.1.3.

However, when I try to run the script in SikuliX 1.1.4, I receive this error:
"driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] not found"

It's the same exact script, just running in 1.1.4 instead of 1.1.3.

The code that I am using to connect to SQL can be viewed in my post here:
https://answers.launchpad.net/sikuli/+question/672153

Is this a bug, or do I need to load the SQL Driver differently in 1.1.4
than I do in 1.1.2 & 3?

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #673053]: SikuliX 1.1.4: IDE cannot find SQL Driver

2018-08-28 Thread Ron Turrentine
New question #673053 on Sikuli:
https://answers.launchpad.net/sikuli/+question/673053

OS: Windows 7 professional
SQL Server:  2012
Utilizing zxJDBC (ziclix)
Driver: Microsoft JDBC driver 7.0 for SQL Server (obtained here):
(https://www.microsoft.com/en-us/download/details.aspx?id=57175)

With the script that I built in SIkuliX 1.1.2, I can successfully connect to 
our SQL Server and insert/update records.
My script also works well in SikuliX 1.1.3.

However, when I try to run the script in SikuliX 1.1.4, I receive this error:
"driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] not found"

It's the same exact script, just running in 1.1.4 instead of 1.1.3.

The code that I am using to connect to SQL can be viewed in my post here:
https://answers.launchpad.net/sikuli/+question/672153

Is this a bug, or do I need to load the SQL Driver differently in 1.1.4 than I 
do in 1.1.2 & 3?

Thanks!

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #672153]: [HowTo] access SQL Server 12.0.5207 on a Windows Server VM

2018-08-16 Thread Ron Turrentine
Question #672153 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/672153

Description changed to:
 the solution from comment #6 --- thanks to the provider ***
The "missing link" was the Microsoft JDBC Driver 7.0 for SQL Server. I 
downloaded the jar from them here:
https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017
(which directs you to here: 
https://www.microsoft.com/en-us/download/details.aspx?id=57175)

The jar file referenced in my "load" command after the imports.
So far it appears to be working well!

By the way, this is connecting to SQL Server 12.0.5207 on a Windows
Server VM.

Thought that I would share it in case someone else needed help with this
as well.

Thanks for your help, Raiman!

Ron

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
from com.ziclix.python.sql import zxJDBC
import datetime
import sys

load("C:\Users\BYE8557\Documents\SQLJDBC\sqljdbc_7.0\enu\mssql-
jdbc-7.0.0.jre8.jar")

conn = None

d, u, p, v = "jdbc:sqlserver://yourservername", "youruserid",
"yourpassword", "com.microsoft.sqlserver.jdbc.SQLServerDriver"

try:
conn = zxJDBC.connect(d, u, p, v)

cursor = conn.cursor()

cursor.execute("SELECT * FROM dbname.dbo.tablename as a WHERE
a.fieldone = 'sometext' and a.fieldtwo = somevalue")

print cursor.fetchone()

print "DB Name: " + conn.dbname
print "DB Version: " + conn.dbversion
print "Driver Name: " + conn.drivername
print "Driver Version: " + conn.driverversion
print "Database URL: " + str(conn.url)
print "Connection info: " + str(conn.__connection__)
print "Is connection closed? -> " + str(conn.closed)

conn.close()

except:
exc_type, exc_val, exc_tb = sys.exc_info()

ErrorText = "* ERROR IN SCRIPTNAME = " + sys.argv[0] + " *\n"
ErrorText += "Date/Time : " + str(datetime.datetime.now()) + "\n"
ErrorText += "Line Number: " + str(exc_tb.tb_lineno) + "\n"
ErrorText += "Error Type : " + exc_type.__name__ + "\n"
ErrorText += "Error Value: " + exc_val.message + "\n"
ErrorText += 
"***\n\r"

print ErrorText

---

I am running Windows 7.
I have SIkuliX 1.1.2 installed.
I have Python 2.7 installed (C:\Python27)

I have installed pyodbc via pip.

I added a "sites.txt" file per instructions in found in the "Answers" forum.  
The file is located under my AppData folder here:
C:\Users\Ron\AppData\Roaming\Sikulix\Lib\site-packages

The sites.txt file contains only the following line:
C:\Python27\Lib\site-packages\

I placed the line "import pyodbc" in my script, but when I run it I receive a 
traceback error that states:
"ImportError: No module named pyodbc"

I thought that perhaps the pyodbc driver wasn't properly installed, so I tried 
running the pip again, but it reported:
"Requirement already satisfied: pyodbc in c:\python27\lib\site-packages"

I'm obviously doing something wrong. Please let me know how I can get
this working.

Thanks in advance!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #672153]: Using pyodbc with Sikuli

2018-08-14 Thread Ron Turrentine
Question #672153 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/672153

Status: Answered => Solved

Ron Turrentine confirmed that the question is solved:
I took Raiman's advice and nixed pyodbc for zxJDBC instead (which is bundled 
with Sikuli).
It works, and this is how I got  it to work with our SQL Server database. 

The "missing link" was the Microsoft JDBC Driver 7.0 for SQL Server.  I 
downloaded the jar from them here:
https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017
(which directs you to here: 
https://www.microsoft.com/en-us/download/details.aspx?id=57175)

The jar file referenced in my "load" command after the imports.  
So far it appears to be working well!

By the way, this is connecting to SQL Server 12.0.5207 on a Windows
Server VM.

Thought that I would share it in case someone else needed help with this
as well.

Thanks for your help, Raiman!

Ron

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
from com.ziclix.python.sql import zxJDBC

load("C:\Users\BYE8557\Documents\SQLJDBC\sqljdbc_7.0\enu\mssql-
jdbc-7.0.0.jre8.jar")

conn = None

d, u, p, v = "jdbc:sqlserver://yourservername", "youruserid",
"yourpassword", "com.microsoft.sqlserver.jdbc.SQLServerDriver"

try:
conn = zxJDBC.connect(d, u, p, v)

cursor = conn.cursor()

cursor.execute("SELECT * FROM dbname.dbo.tablename as a WHERE
a.fieldone = 'sometext' and a.fieldtwo = somevalue")

print cursor.fetchone()

print "DB Name: " + conn.dbname
print "DB Version: " + conn.dbversion
print "Driver Name: " + conn.drivername
print "Driver Version: " + conn.driverversion
print "Database URL: " + str(conn.url)
print "Connection info: " + str(conn.__connection__)
print "Is connection closed? -> " + str(conn.closed)

conn.close()

except:
exc_type, exc_val, exc_tb = sys.exc_info()

ErrorText  = "* ERROR IN SCRIPTNAME = " + sys.argv[0] + " *\n"
ErrorText += "Date/Time  : " + str(datetime.datetime.now()) + "\n"
ErrorText += "Line Number: " + str(exc_tb.tb_lineno) + "\n"
ErrorText += "Error Type : " + exc_type.__name__ + "\n"
ErrorText += "Error Value: " + exc_val.message + "\n"
ErrorText += 
"***\n\r"

print ErrorText

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #672153]: Using pyodbc with Sikuli

2018-08-13 Thread Ron Turrentine
Question #672153 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/672153

Ron Turrentine gave more information on the question:
PS:  don't see the bundled JDBC jar file.  Where would I find it?

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #672153]: Using pyodbc with Sikuli

2018-08-13 Thread Ron Turrentine
Question #672153 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/672153

Status: Answered => Open

Ron Turrentine is still having a problem:
Thanks Raiman! I will definitely look into using JDBC and the load()
statement.

BTW I checked and my machine is on Java 8 build 171.

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #672153]: Using pyodbc with Sikuli

2018-08-13 Thread Ron Turrentine
New question #672153 on Sikuli:
https://answers.launchpad.net/sikuli/+question/672153

I am running Windows 7.
I have SIkuliX 1.1.2 installed.
I have Python 2.7 installed (C:\Python27)

I have installed pyodbc via pip.

I added a "sites.txt" file per instructions in found in the "Answers" forum.  
The file is located under my AppData folder here:
C:\Users\Ron\AppData\Roaming\Sikulix\Lib\site-packages

The sites.txt file contains only the following line:
C:\Python27\Lib\site-packages\

I placed the line "import pyodbc" in my script, but when I run it I receive a 
traceback error that states:
"ImportError: No module named pyodbc"

I thought that perhaps the pyodbc driver wasn't properly installed, so I tried 
running the pip again, but it reported:
"Requirement already satisfied: pyodbc in c:\python27\lib\site-packages"

I'm obviously doing something wrong. Please let me know how I can get this 
working.

Thanks in advance!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Status: Open => Solved

Ron Turrentine confirmed that the question is solved:
I got 1.1.3 installed and working.  Thanks Raiman.
And my script ran within it and is giving me error & info feedback in the 
Message area.

I appreciate your help!

Best Regards,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Ron Turrentine gave more information on the question:
I apologize for the multiple posts, but I have found the installer
download page for the Nightly Build:

https://raiman.github.io/SikuliX1/nightly.html

I am running the  setup now.  I will let you know how it goes.

Thanks,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Ron Turrentine gave more information on the question:
Raiman,

I found your github page (https://github.com/RaiMan/SikuliX1/releases),
but I'm not sure how to use the source code.  I'm not a java developer.
Is there a JAR installer available to install 1.1.3 on Windows?

Thanks!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Ron Turrentine gave more information on the question:
PS: I'm on Windows 7 professional

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Status: Needs information => Open

Ron Turrentine gave more information on the question:
Raiman,

Thanks for the "object" info, did not realize that!

Regarding the version, I'm on 1.1.2.   I notice that you mentioned 1.1.3
"nightly", but when I visited your downloads page
(https://launchpad.net/sikuli/+download) - which is where I downloaded
the IDE - I could not find a link to obtain 1.1.3.

Can you please share that URL here?

Thanks again!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-08 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Status: Answered => Open

Ron Turrentine is still having a problem:
Hey RaiMan,

Thanks so much for you helpful input.  In answer to your questions:

1.) The browser did not open
2.) No screenshots were taken
3.) I did have some helpful "print" commands at various points in my script, 
but I had stripped them out before uploading it here.
a.) Nothing was printed in the Message area.
b.) In fact, there was no output at all. The Message area was completely 
empty.
4.) I will definitely look into your os.path.join method.  That sounds like the 
perfect solution. 
a.)The string concatenation was "not pretty", which is why I went with a 
list of strings along with the string.join method (it worked better than the 
"+" operator for more than 2 strings).
5.) I don't see anything in your class example that is different from what I 
was doing except for the fact that you did not have "object" between the 
parentheses (like so:  class PDA(object):). Is that a problem?

I noticed that in my _init_ function that I pasted in my original post
that the indentation was lost on the property lines. Perhaps there was
something amiss with that?  The other functions seemed to keep the
indentation that they had from the IDE when I copied it.

Thanks again for your helpfulness!

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-07 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Ron Turrentine gave more information on the question:
I made some big changes to my script and got it working after I stripped
out the class and changed the class properties to global variables.

This is the working script, however I would love to get it working with
the functions as methods within a class:

###

import os
import shutil
import datetime

def takescreenshot():

# import global variables
global sscount
global mypath
global formatssname

# increment screenshot count
sscount += 1

# format out filename using the SS count
nextname = formatssname()

# get our main full screen coords defined
screen = (SCREEN.getX(), SCREEN.getY(), SCREEN.getW(), SCREEN.getH())

# capture the defined screen  
img = capture(*screen)

# put the pieces of our new filename into a list
strjoin = (mypath, nextname)

# concatenate the path with the filename (putting a backslash between them)
newFile = "\\".join(strjoin)

# save the screenshot
shutil.copy(img, newFile)

def formatssname():

# import global variable
global sscount

strPad = ""

strcount = str(sscount)

# Determine length of our SS Count, then prepend the appropriuate # of 
zeroes to its number and append a .png
if len(strcount) == 1:
strPad = "" + strcount
elif len(strcount) == 2:
strPad = "000" + strcount
elif len(strcount) == 3:
strPad = "00" + strcount
elif len(strcount) == 4:
strPad = "0" + strcount

strPad = strPad + '.png'

return strPad

def setupbrowser():

# import global variables
global browser
global siteurl

# extract browser filename from PDA.browser property
browsername = os.path.basename(browser)

# Close all instances of the aforementioned browser
closeApp(browsername)

wait(5)

# Define our browser object
pdabrowser = App(browser)

wait(2)

# Open the browser
pdabrowser.open()

wait(5)

 #Focus on the browser
pdabrowser.focus()

wait(2)

# Access the address bar
type("l", KeyModifier.CTRL)

wait(2)

# Enter Site URL and navigate to it
type(siteurl + Key.ENTER)

def createfolders():

# import global variables
global fullpath
global mypath

# Concatenate  full path string
fullpath = backslash.join(pathinfo)

# Store path in dir obj
mypath = os.path.dirname(fullpath)

# Check if path exists.  If not, create it
if not os.path.exists(mypath):
os.makedirs(mypath)

# Setup global variables and environment
basepath   = "c:\\screenshots\\doesthiswork"
browser= "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
testsite   = "Test"
testtype   = "Default"
sscount= 0
folderdate = 
str(datetime.date.strftime(datetime.datetime.date(datetime.datetime.now()),'%m-%d-%y'))
fullpath   = ""
siteurl= "https://www.google.com/";
backslash  = "\\"
pathinfo   = (basepath, testsite, folderdate, testtype)
mypath = ""

# Create our folders
createfolders()

# Setup our browser
setupbrowser()

# take screenshot
takescreenshot()

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-07 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Description changed to:
When I click "Run" or "Run in slow motion", the SikuliX IDE attempts to
run my script, but then it immediately stops.  However it provides no
error output - in fact, it provides no feedback whatsoever in the
"Message" window.

This has been occurring all morning.  I copied my script, then re-
entered it line by line by hand.  When I attempted to run it, it threw
an error on a line where I had a typo.  I corrected the typo, saved it,
but now it's doing the "I'll give you no feedback whatsoever" thing
again.

Could there perhaps be an issue with indentation?  I have gone over the
code many times, and it *looks* OK to me (my wife would roll her eyes,
she knows how well I look at stuff). I know that I must be missing
something.  I wish the IDE would give me some sort of feedback on why it
won't run, but it is not being helpful at all.

I should note that I have also reinstalled SikuliX just to be safe.
Unfortunately that did not help.

The code is below.  Any help/input is quite appreciated!

Thank you in advance,

Ron

#
import os
import shutil
import datetime

### Beginning Class PDA ###
class PDA(object):

def __init__(self):
self.BasePath = "c:\\screenshots"
self.Browser = "Chrome"
self.TestSite = "Test"
self.TestType = "Default"
self.SSCount = 0
self.FolderDate = 
str(datetime.date.strftime(datetime.datetime.date(datetime.datetime.now()),'%m-%d-%y'))
self.FullPath = ""
self.SiteURL = "https://www.google.com/";

def TakeScreenShot(self, path):
#increment screenshot count
self.SSCount += 1

# cast the count to string
strcount = str(self.SSCount)

#format out filename using the SS count
nextname = self.FormatSSName(strcount)

# get our main full screen coords defined
screen = (SCREEN.getX(), SCREEN.getY(), SCREEN.getW(), SCREEN.getH())

# capture the defined screen  
img = capture(*screen)

#put the pieces of our new filename into a list
strjoin = (path, nextname)

# concatenate the path with the filename (putting a backslash between 
them)
newFile = "\\".join(strjoin)

# save the screenshot
shutil.copy(img, newFile)

def FormatSSName(self, strcount):

strPad = ""

# Determine length of our SS Count, then prepend the appropriuate # of 
zeroes to its number and append a .png
if len(strcount) == 1:
strPad = "" + strcount
strPad = strPad + ".png"
elif len(strcount) == 2:
strPad = "000" + strcount
strPad = strPad + ".png"
elif len(strcount) == 3:
strPad = "00" + strcount
strPad = strPad + ".png"
elif len(strcount) == 4:
strPad = "0" + strcount
strPad = strPad + ".png"
else:
strPad = strcount + ".png"

return strPad

def SetupBrowser(self):

#extract browser filename from PDA.Browser property
browsername = os.path.basename(self.Browser)

#Close all instances of the aforementioned browser
closeApp(browsername)

wait(5)

#Define our browser object
pdaBrowser = App(self.Browser)

wait(2)

#Open the browser
pdaBrowser.open()

wait(5)

#Focus on the browser
pdaBrowser.focus()

wait(2)

#Access the address bar
type("l", KeyModifier.CTRL)

wait(2)

#Enter Site URL and navigate to it
type(self.SiteURL + Key.ENTER)

### Ending Class PDA ###

### SET ENVIRONMENT ###
# Define PDA object
myPDA = PDA()

# define path, browser type, folder names and navigation URL
myPDA.BasePath = "C:\\screenshots\\sikulitest"
myPDA.Browser  = "C:\\Program Files 
(x86)\\Google\\Chrome\\Application\\chrome.exe"
myPDA.TestSite = "TestSite"
myPDA.TestType = "Default"
myPDA.SiteURL  = "https://www.google.com";

backslash = "\\"
pathinfo  = (myPDA.BasePath, myPDA.TestSite, myPDA.FolderDate, myPDA.TestType)

#Concatenate  full path string
myPDA.FullPath = backslash.join(pathinfo)

#Store path in dir obj
myPath = os.path.dirname(myPDA.FullPath)

#Check if path exists.  If not, create it
if not os.path.exists(myPath):
os.makedirs(myPath)

#Setup our browser
myPDA.SetupBrowser

#Take a screenshot
myPDA.TakeScreenShot(myPath)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-07 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Description changed to:
When I click "Run" or "Run in slow motion", the SikuliX IDE attempts to
run my script, but then it immediately stops.  However it provides no
error output - in fact, it provides no feedback whatsoever in the
"Message" window.

This has been occurring all morning.  I copied my script, then re-
entered it line by line by hand.  When I attempted to run it, it threw
an error on a line where I had a typo.  I corrected the typo, saved it,
but now it's doing the "I'll give you no feedback whatsoever" thing
again.

Could there perhaps be an issue with indentation?  I have gone over the
code many times, and it *looks* OK to me (my wife would roll her eyes,
she knows how well I look at stuff). I know that I must be missing
something.  I wish the IDE would give me some sort of feedback on why it
won't run, but it is not being helpful at all.

The code is below.  Any help/input is quite appreciated!

Thank you in advance,

Ron

#
import os
import shutil
import datetime

### Beginning Class PDA ###
class PDA(object):

def __init__(self):
self.BasePath = "c:\\screenshots"
self.Browser = "Chrome"
self.TestSite = "Test"
self.TestType = "Default"
self.SSCount = 0
self.FolderDate = 
str(datetime.date.strftime(datetime.datetime.date(datetime.datetime.now()),'%m-%d-%y'))
self.FullPath = ""
self.SiteURL = "https://www.google.com/";

def TakeScreenShot(self, path):
#increment screenshot count
self.SSCount += 1

# cast the count to string
strcount = str(self.SSCount)

#format out filename using the SS count
nextname = self.FormatSSName(strcount)

# get our main full screen coords defined
screen = (SCREEN.getX(), SCREEN.getY(), SCREEN.getW(), SCREEN.getH())

# capture the defined screen  
img = capture(*screen)

#put the pieces of our new filename into a list
strjoin = (path, nextname)

# concatenate the path with the filename (putting a backslash between 
them)
newFile = "\\".join(strjoin)

# save the screenshot
shutil.copy(img, newFile)

def FormatSSName(self, strcount):

strPad = ""

# Determine length of our SS Count, then prepend the appropriuate # of 
zeroes to its number and append a .png
if len(strcount) == 1:
strPad = "" + strcount
strPad = strPad + ".png"
elif len(strcount) == 2:
strPad = "000" + strcount
strPad = strPad + ".png"
elif len(strcount) == 3:
strPad = "00" + strcount
strPad = strPad + ".png"
elif len(strcount) == 4:
strPad = "0" + strcount
strPad = strPad + ".png"
else:
strPad = strcount + ".png"

return strPad

def SetupBrowser(self):

#extract browser filename from PDA.Browser property
browsername = os.path.basename(self.Browser)

#Close all instances of the aforementioned browser
closeApp(browsername)

wait(5)

#Define our browser object
pdaBrowser = App(self.Browser)

wait(2)

#Open the browser
pdaBrowser.open()

wait(5)

#Focus on the browser
pdaBrowser.focus()

wait(2)

#Access the address bar
type("l", KeyModifier.CTRL)

wait(2)

#Enter Site URL and navigate to it
type(self.SiteURL + Key.ENTER)

### Ending Class PDA ###

### SET ENVIRONMENT ###
# Define PDA object
myPDA = PDA()

# define path, browser type, folder names and navigation URL
myPDA.BasePath = "C:\\screenshots\\sikulitest"
myPDA.Browser  = "C:\\Program Files 
(x86)\\Google\\Chrome\\Application\\chrome.exe"
myPDA.TestSite = "TestSite"
myPDA.TestType = "Default"
myPDA.SiteURL  = "https://www.google.com";

backslash = "\\"
pathinfo  = (myPDA.BasePath, myPDA.TestSite, myPDA.FolderDate, myPDA.TestType)

#Concatenate  full path string
myPDA.FullPath = backslash.join(pathinfo)

#Store path in dir obj
myPath = os.path.dirname(myPDA.FullPath)

#Check if path exists.  If not, create it
if not os.path.exists(myPath):
os.makedirs(myPath)

#Setup our browser
myPDA.SetupBrowser

#Take a screenshot
myPDA.TakeScreenShot(myPath)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-07 Thread Ron Turrentine
New question #671416 on Sikuli:
https://answers.launchpad.net/sikuli/+question/671416

When I click "Run" or "Run in slow motion", the SikuliX IDE attempts to run my 
script, but then it immediately stops.  However it provides no error output - 
in fact, it provides no feedback whatsoever in the "Message" window. 

This has been occurring all morning.  I copied my script, then re-entered it 
line by line by hand.  When I attempted to run it, it threw an error on a line 
where I had a typo.  I corrected the typo, saved it, but now it's doing the 
"I'll give you no feedback whatsoever" thing again. 

Could there perhaps be an issue with indentation?  I have gone over the code 
many times, but i *looks* ok to me (my wife would roll her eyes, she knows how 
well I look at stuff). I know that I must be missing something.  I wish the IDE 
would give me some sort of feedback on why it won't run, but it is not being 
helpful at all.

The code is below.  Any help/input is quite appreciated!

Thank you in advance,

Ron

import os
import shutil
import datetime

### Beginning Class PDA ###
class PDA(object):

def __init__(self):
self.BasePath = "c:\\screenshots"
self.Browser = "Chrome"
self.TestSite = "Test"
self.TestType = "Default"
self.SSCount = 0
self.FolderDate = 
str(datetime.date.strftime(datetime.datetime.date(datetime.datetime.now()),'%m-%d-%y'))
self.FullPath = ""
self.SiteURL = "https://www.google.com/";

def TakeScreenShot(self, path):
#increment screenshot count
self.SSCount += 1

# cast the count to string
strcount = str(self.SSCount)

#format out filename using the SS count
nextname = self.FormatSSName(strcount)

# get our main full screen coords defined
screen = (SCREEN.getX(), SCREEN.getY(), SCREEN.getW(), SCREEN.getH())

# capture the defined screen  
img = capture(*screen)

#put the pieces of our new filename into a list
strjoin = (path, nextname)

# concatenate the path with the filename (putting a backslash between 
them)
newFile = "\\".join(strjoin)

# save the screenshot
shutil.copy(img, newFile)

def FormatSSName(self, strcount):

strPad = ""

# Determine length of our SS Count, then prepend the appropriuate # of 
zeroes to its number and append a .png
if len(strcount) == 1:
strPad = "" + strcount
strPad = strPad + ".png"
elif len(strcount) == 2:
strPad = "000" + strcount
strPad = strPad + ".png"
elif len(strcount) == 3:
strPad = "00" + strcount
strPad = strPad + ".png"
elif len(strcount) == 4:
strPad = "0" + strcount
strPad = strPad + ".png"
else:
strPad = strcount + ".png"

return strPad

def SetupBrowser(self):

#extract browser filename from PDA.Browser property
browsername = os.path.basename(self.Browser)

#Close all instances of the aforementioned browser
closeApp(browsername)

wait(5)

#Define our browser object
pdaBrowser = App(self.Browser)

wait(2)

#Open the browser
pdaBrowser.open()

wait(5)

#Focus on the browser
pdaBrowser.focus()

wait(2)

#Access the address bar
type("l", KeyModifier.CTRL)

wait(2)

#Enter Site URL and navigate to it
type(self.SiteURL + Key.ENTER)

### Ending Class PDA ###

### SET ENVIRONMENT ###
# Define PDA object
myPDA = PDA()

# define path, browser type, folder names and navigation URL
myPDA.BasePath = "C:\\screenshots\\sikulitest"
myPDA.Browser  = "C:\\Program Files 
(x86)\\Google\\Chrome\\Application\\chrome.exe"
myPDA.TestSite = "TestSite"
myPDA.TestType = "Default"
myPDA.SiteURL  = "https://www.google.com";

backslash = "\\"
pathinfo  = (myPDA.BasePath, myPDA.TestSite, myPDA.FolderDate, myPDA.TestType)

#Concatenate  full path string
myPDA.FullPath = backslash.join(pathinfo)

#Store path in dir obj
myPath = os.path.dirname(myPDA.FullPath)

#Check if path exists.  If not, create it
if not os.path.exists(myPath):
os.makedirs(myPath)

#Setup our browser
myPDA.SetupBrowser

#Take a screenshot
myPDA.TakeScreenShot(myPath)


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671416]: Script attempts to run then immediately stops, but provides no error msg

2018-08-07 Thread Ron Turrentine
Question #671416 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671416

Description changed to:
When I click "Run" or "Run in slow motion", the SikuliX IDE attempts to
run my script, but then it immediately stops.  However it provides no
error output - in fact, it provides no feedback whatsoever in the
"Message" window.

This has been occurring all morning.  I copied my script, then re-
entered it line by line by hand.  When I attempted to run it, it threw
an error on a line where I had a typo.  I corrected the typo, saved it,
but now it's doing the "I'll give you no feedback whatsoever" thing
again.

Could there perhaps be an issue with indentation?  I have gone over the
code many times, but i *looks* ok to me (my wife would roll her eyes,
she knows how well I look at stuff). I know that I must be missing
something.  I wish the IDE would give me some sort of feedback on why it
won't run, but it is not being helpful at all.

The code is below.  Any help/input is quite appreciated!

Thank you in advance,

Ron

#
import os
import shutil
import datetime

### Beginning Class PDA ###
class PDA(object):

def __init__(self):
self.BasePath = "c:\\screenshots"
self.Browser = "Chrome"
self.TestSite = "Test"
self.TestType = "Default"
self.SSCount = 0
self.FolderDate = 
str(datetime.date.strftime(datetime.datetime.date(datetime.datetime.now()),'%m-%d-%y'))
self.FullPath = ""
self.SiteURL = "https://www.google.com/";

def TakeScreenShot(self, path):
#increment screenshot count
self.SSCount += 1

# cast the count to string
strcount = str(self.SSCount)

#format out filename using the SS count
nextname = self.FormatSSName(strcount)

# get our main full screen coords defined
screen = (SCREEN.getX(), SCREEN.getY(), SCREEN.getW(), SCREEN.getH())

# capture the defined screen  
img = capture(*screen)

#put the pieces of our new filename into a list
strjoin = (path, nextname)

# concatenate the path with the filename (putting a backslash between 
them)
newFile = "\\".join(strjoin)

# save the screenshot
shutil.copy(img, newFile)

def FormatSSName(self, strcount):

strPad = ""

# Determine length of our SS Count, then prepend the appropriuate # of 
zeroes to its number and append a .png
if len(strcount) == 1:
strPad = "" + strcount
strPad = strPad + ".png"
elif len(strcount) == 2:
strPad = "000" + strcount
strPad = strPad + ".png"
elif len(strcount) == 3:
strPad = "00" + strcount
strPad = strPad + ".png"
elif len(strcount) == 4:
strPad = "0" + strcount
strPad = strPad + ".png"
else:
strPad = strcount + ".png"

return strPad

def SetupBrowser(self):

#extract browser filename from PDA.Browser property
browsername = os.path.basename(self.Browser)

#Close all instances of the aforementioned browser
closeApp(browsername)

wait(5)

#Define our browser object
pdaBrowser = App(self.Browser)

wait(2)

#Open the browser
pdaBrowser.open()

wait(5)

#Focus on the browser
pdaBrowser.focus()

wait(2)

#Access the address bar
type("l", KeyModifier.CTRL)

wait(2)

#Enter Site URL and navigate to it
type(self.SiteURL + Key.ENTER)

### Ending Class PDA ###

### SET ENVIRONMENT ###
# Define PDA object
myPDA = PDA()

# define path, browser type, folder names and navigation URL
myPDA.BasePath = "C:\\screenshots\\sikulitest"
myPDA.Browser  = "C:\\Program Files 
(x86)\\Google\\Chrome\\Application\\chrome.exe"
myPDA.TestSite = "TestSite"
myPDA.TestType = "Default"
myPDA.SiteURL  = "https://www.google.com";

backslash = "\\"
pathinfo  = (myPDA.BasePath, myPDA.TestSite, myPDA.FolderDate, myPDA.TestType)

#Concatenate  full path string
myPDA.FullPath = backslash.join(pathinfo)

#Store path in dir obj
myPath = os.path.dirname(myPDA.FullPath)

#Check if path exists.  If not, create it
if not os.path.exists(myPath):
os.makedirs(myPath)

#Setup our browser
myPDA.SetupBrowser

#Take a screenshot
myPDA.TakeScreenShot(myPath)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671390]: How to build a path within an existing directory

2018-08-06 Thread Ron Turrentine
Question #671390 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671390

Status: Answered => Solved

Ron Turrentine confirmed that the question is solved:
Thank you RaiMan!  I appreciate your helpful reply.   I got it working!

I'm learning a great deal about both Python & Sikuli through the process.
I'm really enjoy it.

Best regards,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671390]: How to build a path within an existing directory

2018-08-06 Thread Ron Turrentine
Question #671390 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671390

Ron Turrentine gave more information on the question:
I seem to have found the answer! 
The code that appears to be a good, working replacement is:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

FullPath = "C:\Screenshots\Sikuli_Test\08-05-18\ProdTest"

myPath = os.path.dirname(FullPath)

if not os.path.exists(myPath):
os.makedirs(myPath)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

I am going to keep this open, though, to see if anyone has any other
suggestions. I would like to read them, as I am learning.

Thanks,

Ron

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #671390]: How to build a path within an existing directory

2018-08-06 Thread Ron Turrentine
Question #671390 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671390

Description changed to:
Note: I am new to Python & SikuliX

I am looking at using SikuliX as an automation replacement for an existing 
script that I have in HPE UFT.  
One of the things I am struggling with is how to create directory structures  
inside existing folders.

For example, let's say that I have a base folder called "C:\Screenshots"
for the storing of screenshots from various applications.

In UFT, I have a VBScript function that checks to see if the full path exists - 
if it doesn't, it creates it:
(Note that the application name and the test type are determined elsewhere in 
the script on the fly)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
FullPath = "C:\Screenshots\MyApp\08-05-18\ProdTest"

Private Function BuildFullPath(ByVal FullPath)

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")

If Not objFSO.FolderExists(FullPath) Then

BuildFullPath objFSO.GetParentFolderName(FullPath)
objFSO.CreateFolder FullPath

End If

Set objFSO = Nothing

End Function
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The above function will iterate through the folder structure, and if any
portion of the path doesn't exist, it will create it.

I tried the below code in SIkuliX.  
(The folder structure of "C:\Screenshots\Sikuli_Test" already exists.)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

import os

FullPath = "C:\Screenshots\Sikuli_Test\08-05-18\ProdTest"

os.mkdir(FullPath)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

SikuliX returned the following error:

OSError: (17, 'File exists', 'c:\\screenshots\\sikuli_test'

Part of the challenge is that the script will not always know how deep
the given folder structure will already go.  The script will need to
determine this, and then create the missing folders as needed.

The VBScript function outlined above is simple & fast in its loop with
the FileSystemObject. Is there a way to do something similarly elegant
within Python & SikuliX?

Side question: can Python discern between a directory and a file? The
error returned leads me to believe that it is confusing a an existing
folder as an existing file.

Thanks in advance,

Ron Turrentine

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #671390]: How to build a path within an existing directory

2018-08-06 Thread Ron Turrentine
New question #671390 on Sikuli:
https://answers.launchpad.net/sikuli/+question/671390

Note: I am new to Python & SikuliX

I am looking at using SikuliX as an automation replacement for an existing 
script that I have in HPE UFT.  
One of the things I am struggling with is how to create directory structures  
inside existing folders.

For example, let's say that I have a base folder called "C:\Screenshots" for 
the storing of screenshots from various applications.

In UFT, I have a VBScript function that checks to see if the full path exists - 
if it doesn't, it creates it:
(Note that the application name and the test type are determined elsewhere in 
the script on the fly)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
FullPath = "C:\Screenshots\MyApp\08-05-18\ProdTest"

Private Function BuildFullPath(ByVal FullPath)

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")

If Not objFSO.FolderExists(FullPath) Then

BuildFullPath objFSO.GetParentFolderName(FullPath)
objFSO.CreateFolder FullPath

End If

Set objFSO = Nothing

End Function
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The above function will iterate through folder structure, and if any portion of 
the path doesn't exist, it will create it.

I tried the below code in SIkuliX.  
(The folder structure of "C:\Screenshots\Sikuli_Test" already exists.)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

import os

FullPath = "C:\Screenshots\Sikuli_Test\08-05-18\ProdTest"

os.mkdir(FullPath)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

SikuliX returned the following error:

OSError: (17, 'File exists', 'c:\\screenshots\\sikuli_test'

Part of the challenge is that the script will not always know how deep the 
given folder structure will already exist.  The script will need to determine 
this, and then create the folders as needed.

The VBScript function outlined above this simple & fast in its loop with the 
FileSystemObject. Is there a way to do something similar within Python & 
SikuliX?

Side question: can Python discern between a directory and a file? The error 
returned leads me to believe that it is confusing a an existing folder as an 
existing file.

Thanks in advance,

Ron Turrentine


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp