Win7/Cygwin socket errors

May 9, 2013 at 1:05 AM
Hi LDTP:

I installed the Cobra 3.0 msi OK, and it was running under Cygwin/Win 7. I closed the window, did some other things, opened another Cygwin session, and now I get socket errors.
from ldtp import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ldtp/init.py", line 545, in <module>
_populateNamespace(globals())
File "/usr/lib/python2.7/site-packages/ldtp/init.py", line 225, in _populateNamespace
for method in client._client.system.listMethods():
File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 136, in request
self.send_content(h, request_body)
File "/usr/lib/python2.7/xmlrpclib.py", line 1439, in send_content
connection.endheaders(request_body)
File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 776, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 757, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 111] Connection refused


Thanks,
Duane
Coordinator
May 9, 2013 at 3:57 AM
Duane,

I have made a quick fix, Can you please verify with latest source update ?

Thanks
May 9, 2013 at 6:19 AM
Hi:

Sorry, I don't know how to compile from the latest sources. Can I use git to get the latest tree?

Duane
Coordinator
May 9, 2013 at 6:22 AM
Hi Duane,

Yes you can use git to get the latest source.

Thanks
Nagappan
May 9, 2013 at 6:00 PM
Hi Nagappan:

Sorry, I'm a hardware guy, and don't know how to use C# Visual Studio Express.

I downloaded the sources. The README says to compile SetEnvironmentVariable and CobraWinLdtp solutions. I opened cobra/SetEnvrionmentVariable/SetEnvrionmentVariable.csproj in Visual Studio Express, and hit Build/Build Solution. I got these errors. Looks like something is missing from a path.

Error 1 The type or namespace name 'Ldtpd' could not be found (are you missing a using directive or an assembly reference?) C:\Users\duanet\Documents\Visual Studio 2010\Projects\cobra\CobraWinLDTP\LdtpdService.cs 35 7 CobraWinLDTP
Error 2 The type or namespace name 'Common' could not be found (are you missing a using directive or an assembly reference?) C:\Users\duanet\Documents\Visual Studio 2010\Projects\cobra\CobraWinLDTP\LdtpdService.cs 47 16 CobraWinLDTP
Error 3 The type or namespace name 'WindowList' could not be found (are you missing a using directive or an assembly reference?) C:\Users\duanet\Documents\Visual Studio 2010\Projects\cobra\CobraWinLDTP\LdtpdService.cs 48 16 CobraWinLDTP

Can you help me with this?

Thanks,
Duane
May 9, 2013 at 10:33 PM
Got past that problem, installed and tried to run WiX which failed because it's missing ldtp.jar. Downloaded all the *jar files, but can't generate ldtp.jar.

Duane
Coordinator
May 9, 2013 at 10:55 PM
Hi Duane,

Can you try this: http://people.freedesktop.org/~nagappan/temp/CobraWinLDTP.msi ?

Thanks
Nagappan
May 9, 2013 at 11:46 PM
Hi Nagappan:

It's working! Thank you very much!

It looks like it's waiting the default 30s before it updates text boxes or pushes buttons. I tried to change the time by using 'guitimeout', but says that 'guitimeout' is not defined.
guitimeout(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'guitimeout' is not defined
Regards,
Duane
Coordinator
May 10, 2013 at 12:48 AM
Hi Duane,

guitimeout is for window wait time, let me implement it sooner, for object time out, you can use [1]

Can you please share me a test scenario to verify at my end ?

Thanks
Nagappan



May 10, 2013 at 12:55 AM
Hi Nagappan:

I'm trying to automate a licensed HW tool that you probably don't have a license for.

I think I might be able to reproduce the delay problems with notepad. I have to leave soon, but I can start working on the notepad test bench ~7 tonight.

Thank you again for your help,
Duane
Coordinator
May 10, 2013 at 1:05 AM
Hi Duane,

I use active state python, maybe you can try that ?

Thanks
Nagappan


May 10, 2013 at 1:13 AM
Hi Nagappan:

I've been using Python2.7 for Windows from python.org. I run my python script from a DOS batch file from a command window. The run.bat batch file looks like this:

$ cat run.bat
c:\Python27\python.exe blah.py

I can try Active State Python if you think that will work better.

Regards,
Duane
May 10, 2013 at 1:20 AM
Wow! There's no delay with Active State Python!

Duane
May 10, 2013 at 1:27 AM
I spoke too soon. When I run each line of my script in the Active State Python shell, the commands are executed without delay. It's the same for the Python27 shell; there's no delay with this shell either.

I only see delays when I try to run the entire script via my DOS batch file.

Duane
Coordinator
May 10, 2013 at 1:44 AM
Hi Duane,

That's interesting, I haven't faced such issue, is this in cygwin env ? I never tried on that.

Thanks
Nagappan


May 10, 2013 at 2:01 AM
Hi Nagappan:

I see a similar delay when I run the script in Cygwin.

Do you have a recommendation for running the Python/Cobra script under Windows?

Thanks,
Duane
May 10, 2013 at 3:14 AM
Here's the notepad script:

from ldtp import *
launchapp ('notepad.exe')
selectmenuitem('frmUntitled*','mnuFile;mnuSave As...')
settextvalue('frmUntitled*','txtFilename','C:\test.txt')
click('dlgSave As','btnSave')
click('dlgConfirm Save As','btnYes')

The delays are not as long as my tool.

Duane
Coordinator
May 10, 2013 at 5:10 AM
Hi Duane,

Not sure what do you mean here by running under Windows ? Cobra is developed to run under Windows only. We never have any such issue in Windows 7 SP1/Vista SP2/XP SP3/Windows 8. Not sure about your environment. I'm running out of options based on your input. Let me try the test scripts, tomorrow at work.

Thanks
Nagappan


May 10, 2013 at 4:43 PM
Edited May 10, 2013 at 4:49 PM
Hi Nagappan:

Sorry for the confusion.

How would you run my notepad script? Would you open a command prompt window, and do a "c:\Python<version>\python.exe notepad.py"?

I'm wondering if my method is causing the delays I'm seeing.

Also, there's a long delay associated with adding this line to the end of the script:

selectmenuitem('frmtest.txt*','mnuFile;mnuExit')

Thanks,
Duane
Coordinator
May 10, 2013 at 5:48 PM
Hi Duane,

Yes, I run them from regular command prompt.

run->cmd

c:\> python notepad.py # Assuming python.exe is in path

Thanks
Nagappan



May 10, 2013 at 6:51 PM
Hi Nagappan:

Thanks for your reply.

I think I found the dependency. The last statement of notepad.py, selectmenuitem('frmtest.txt*','mnuFile;mnuExit'), runs slowly when the ActiveState IDLE (Python GUI) is open.

When I close the IDLE, notepad.py, runs normally without delay. So it looks like having the IDLE open slows things down.

Regards,
Duane
Coordinator
May 10, 2013 at 7:06 PM
Hi Duane,

That's interesting to know :-)

Thanks
Nagappan