Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith

On 11/30/2010 10:37 AM, Walter Prins wrote:

Hello John

(snip)

In any case, to fix it let's delete all instances of pySerial and then
install it again, as follows:

1.) Open up your Python site-packages folder in Windows Explorer, e.g.
open up:
E:\Python27\lib\site-packages

2.) Delete any folder named serial that you may see.

3.) Delete any *file* name pyserial*.* that you may see, probably you'll
see pyserial-2.4-py2.7.egg, there may also be an info file.

4.) Open up a Python shell and confirm that you can't import pyserial
anymore (e.g. import serial fails with e.g. ImportError: No module
named serial.  If it still imports then you still have some vestiges of
the existing pyserial installation left over.

5.) After confirming the previous versions are gone, please try
reinstalling it again from scratch.  (E.g. extract source to some
suitable place and run python setup.py install from there, which
copies the required files into site-packages etc.)

6.) After installing, confirm import serial works again, then try your
test again.

Apologies again for adding to the confusion, and hopefully we're getting
closer. :-(

Walter



Hi, Walter -

I did the above and then got this:

 import serial

Traceback (most recent call last):
  File pyshell#0, line 1, in module
import serial
  File E:\Python27\lib\site-packages\serial\__init__.py, line 18, in 
module

from serialwin32 import *
  File E:\Python27\lib\site-packages\serial\serialwin32.py, line 9, 
in module

import win32file  # The base COM port and file IO functions.
ImportError: No module named win32file


I guess that file was included in 2.5 but not in 2.4?

Thanks,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith

On 11/30/2010 6:23 PM, Walter Prins wrote:

Hello John,

(snip)

Apparently so.  Well, win32file is part of the PyWin32 package, which
are a set of modules that wrap many Windows API's.   I'm not sure why it
was't/isn't required for PySerial 2.5 or whether as you say perhaps this
module is included in PySerial2.5 and isn't in 2.4.

But whatever the case may be, suffice it to say I've reproduced your
issue on my Win7 64bit box, and then resolved it by installing the
PyWin32 modules.   It's probably a good idea to install this package
anyway -- if you're working on Windows the PyWin32 modules are very
useful - they basically wrap and makes available a shedload of Windows
specific API's to Python. (Many people working with Python on Windows
almost automatically would install this, it's also why i didn't run into
this issue in the first place as I already had PyWin32 installed prior
to testing my suggestion. Sorry.)

Anyway.  To download and install PyWin32, go here: http://ur.ly/vLwv

Presumably you want the AMD64 (64 bit) Py2.7 version.   Install it then
try your test again.

Fingers crossed. ;)

Walter


Hi, Walter -

I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm 
guessing that the AMD versions are for the AMD processor). However, all 
of the exe offerings have the same Python not found in registry 
problem that started this whole thing.


So, since the only source module available is pywin32-214.zip, I got it 
and installed it. It does not work, maybe because I'm using Python 2.7 
and the zip is for 3.2.


I really appreciate all the time you have put into my problems, Walter. 
Thank you.


Cheers,
John


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith

On 11/30/2010 7:27 PM, Adam Bark wrote:

On 01/12/10 01:00, John Smith wrote:


Hi, Walter -

I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm
guessing that the AMD versions are for the AMD processor). However,
all of the exe offerings have the same Python not found in registry
problem that started this whole thing.

So, since the only source module available is pywin32-214.zip, I got
it and installed it. It does not work, maybe because I'm using Python
2.7 and the zip is for 3.2.

I really appreciate all the time you have put into my problems,
Walter. Thank you.

Cheers,
John



Actually, AMD 64 is now the standard x86-64. It was originally designed
by AMD because intel were making their Itanium thing but that didn't go
so well. Anyway if you're running 64 bit windows that's probably why the
32-bit python install is having a problem. Download the version Walter
suggested and you should be good to go.




Yes!

I have gone no farther than to say ser.read() knowing that nothing is 
attached to the port and expected a delay of 5 seconds. It now does 
that, so I have a clue that it is working.


I had no idea that the AMD thing was now standard. Thanks for that. I 
also found that the file Walter recommended did install from the exe 
while the non-AMD file did not due to the registry thing.


Wow! All I can say is thanks to everybody for the help. Now I need to 
start trying to get a modem to talk to me.


By the way, the whole purpose of doing this is to communicate with some 
test instruments via GPIB/HPIB to automate some testing that is time 
consuming. The last time I did this (using a BASIC program), it took 
about 45 minutes (not due to BASIC, but due to instrument response 
time). I was able to start the test, go to lunch, then analyze the data 
when I returned.


Thanks again for the help.

Cheers,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith

On 11/28/2010 8:06 PM, Walter Prins wrote:

John,

(snip stuff)

Ugh, you're probably not going to like this.  I've done some googling
and it appears this may be a 64-bit issue with the ctypes module...
apparently 64-bit ctypes can only import 64-bit libraries.  See here:
http://ur.ly/vSMQ

Then again, it also seems to be an open issue on the PySerial bug
tracker: http://ur.ly/vZNL

Note, the above ticket suggests that PySerial 2.4 works ok (impliedly
even on 64-bit XP, so I imagine also on Windows 7.)  You should be able
to try this out by downloading the 2.4 version instead and installing it
in the same way you did the 2.5 version.  In any case, it might be an
idea to post a report/add a comment to that bug report as well to maybe
help get this issue resolved.

Cheers,

Walter



Hi, Walter -

Thanks for all the research. This was my second attempt at installing 
the 2.4 version. I did it thus:


E:\Python27\pyserial-2.4..\python setup.py install
standart distutils
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\serial
copying serial\serialcli.py - build\lib\serial
copying serial\serialjava.py - build\lib\serial
copying serial\serialposix.py - build\lib\serial
copying serial\serialutil.py - build\lib\serial
copying serial\serialwin32.py - build\lib\serial
copying serial\sermsdos.py - build\lib\serial
copying serial\__init__.py - build\lib\serial
running install_lib
running install_egg_info
Removing E:\Python27\Lib\site-packages\pyserial-2.4-py2.7.egg-info
Writing E:\Python27\Lib\site-packages\pyserial-2.4-py2.7.egg-info

E:\Python27\pyserial-2.4


But, when I tried it in Python, I got the same as before:


 import serial
 ser = serial.Serial(0, timeout = 1)
 ser
Serialid=0x225c240, open=True(port='COM1', baudrate=9600, bytesize=8, 
parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, 
dsrdtr=False)

 ser.read()

Traceback (most recent call last):
  File pyshell#3, line 1, in module
ser.read()
  File E:\Python27\lib\site-packages\serial\serialwin32.py, line 236, 
in read

raise SerialException(ReadFile failed (%s) % ctypes.WinError())
SerialException: ReadFile failed ([Error 6] The handle is invalid.)



Cheers,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith


On 11/29/2010 4:20 PM, Emile van Sebille wrote:

On 11/29/2010 1:44 PM John Smith said...

But, when I tried it in Python, I got the same as before:


 import serial
 ser = serial.Serial(0, timeout = 1)


out of curiosity, if you change the timeout above to 5


 ser
Serialid=0x225c240, open=True(port='COM1', baudrate=9600, bytesize=8,
parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False,
dsrdtr=False)
 ser.read()


... does the delay before printing the traceback below take about 5
seconds?




No. There is no delay regardless of the timeout setting.

John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith


On 11/29/2010 5:56 PM, Emile van Sebille wrote:
(snip)

Hmmm... any chance you don't have administrative rights on the account
performing this? I never got to Win7 (having stopped at XP) but I know
it's got a reputation for excessive permission asking.


You're right about that. It's like Win7 is paranoid. But, it tells me 
when I need to supply administrative permission. Some day I'll find the 
button that tells the system that nobody else uses this computer and to 
shut up and get on with it.



Otherwise, I'd take this up on the main list. Chris Liechti, the
[author|current maintainer|significant contributor] of pyserial monitors
that list and would probably be interested in diagnosing what you're
describing. You could also ask him as per the 'send me a message' link
on his sourceforge page at

http://sourceforge.net/sendmessage.php?touser=403744

Emile


I'll consider that, Emile. First, though, I would like to hear from 
Walter again after my last post.


Thanks for your suggestions.

Cheers,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith

On 11/29/2010 9:41 PM, Rance Hall wrote:

On Mon, Nov 29, 2010 at 8:21 PM, John Smithjocj...@verizon.net  wrote:


On 11/29/2010 5:56 PM, Emile van Sebille wrote:
(snip)


Hmmm... any chance you don't have administrative rights on the account
performing this? I never got to Win7 (having stopped at XP) but I know
it's got a reputation for excessive permission asking.


You're right about that. It's like Win7 is paranoid. But, it tells me when I
need to supply administrative permission. Some day I'll find the button that
tells the system that nobody else uses this computer and to shut up and get
on with it.



Just so you know, Its called User Account Control or UAC.  Google for
disabling UAC on Windows 7 and you can find a tutorial or two on how
to make your computer shut up and get on with it.



Hey, thanks Rance. The info is appreciated.

Cheers,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Pyserial and invalid handle

2010-11-28 Thread John Smith


Can anybody tell me why the handle below is invalid? I'm running Win7.

TIA,
John


Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit 
(AMD64)] on win32

Type copyright, credits or license() for more information.

 import serial
 ser = serial.Serial('com1', timeout = 5)
 x = ser.read()

Traceback (most recent call last):
  File pyshell#2, line 1, in module
x = ser.read()
  File E:\Python27\lib\site-packages\serial\serialwin32.py, line 236, 
in read

raise SerialException(ReadFile failed (%s) % ctypes.WinError())
SerialException: ReadFile failed ([Error 6] The handle is invalid.)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-24 Thread John Smith

Hi, Walter -

Thanks to you, pyserial is installed and imports into Python. Not having 
double backslashes was the latest problem that you got me through.


I am grateful for the support and education you have given me.

Cheers,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-22 Thread John Smith

So, let's see

Serial communications does not come with Python so a separate package 
has to be installed. Okay, but the pyserial Windows installer will not 
work in Windows 7 and will not be fixed. So, a source install is 
required. I _assume_ the source is the one that is a tar.gz thingy. 
Since Windows will not handle the unpacking of that, I have to install a 
decompressor/unpacker to do it. Then I can finally get around to 
installing the serial package. Maybe. Unless I run into a similar 
problem because of Win 7 or because pyserial is 32-bit.


I think it is better that I stop now before I install a bunch of extra 
applications that I need only to install one or two Python modules.


I like Python itself. Very powerful. But I guess I'll look for some 
other language which provides the features I need without the hassle. 
Thanks again for your help.


Cheers,
John


On 11/22/2010 6:18 PM, Emile van Sebille wrote:

On 11/22/2010 3:05 PM John Smith said...

Hi, Emile -

Install from sources? What is that?


see http://pyserial.sourceforge.net/pyserial.html#installation the From
Source section.

I'm not sure what else may be required but it should help get you started.

Emile



I searched for that phrase but did not find anything I could
understand. My shortcoming, perhaps.

Thanks for your reply.

John

On 11/22/2010 4:02 PM, Emile van Sebille wrote:

See
http://sourceforge.net/tracker/index.php?func=detailaid=2921957group_id=46487atid=446302

where it's explained that this bug won't get fixed, but that you can
install from sources.

Emile


On 11/22/2010 1:08 PM ALAN GAULD said...

Forwarding to the list
Please send list mail to tutor@python.org not tutor-owner...

- Forwarded Message 


From: John Smithjocj...@verizon.net
To: tutor-ow...@python.org
Sent: Monday, 22 November, 2010 19:29:37
Subject: Installing Pyserial for Python27 on Win 7

My OS is Win 7. I have the 64-bit Python27 installed and it works
well.

I want to be able to do serial communications. I downloaded Pyserial,
unfortunately in 32 bit release only, and I cannot install it. When I
attempt
the installation, it says No Python installation found in the
registry and I
cannot continue.

1) Does a 64-bit release of Pyserial exist?

2) Will the 32-bit release of Pyserial work with my OS somehow?

3) If the answer is Yes to #2, how do I get past my problem?

Thanks in advance for help.

Cheers,
John


___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor




___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor





___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor