Reading responses from Modem.

Etienne Labuschagne ELabuschagne at gmsonline.co.za
Thu Jul 22 12:04:20 CEST 2004


Assuming the modem is on COM5:

m = open('COM5','wb+')
m.write('+++\r\n')
m.flush()
m.write('ATQ0V1E0\r\n')
m.flush()
m.write('ATDT5551234;\r\n')
m.flush()
response = m.read()

The above program works fine when running it AFTER looking at the modem
diagnostics under the modem's properties in Windows 2000.  If the machine is
restarted and the diagnostics is not run, the program blocks at the response
= m.read() and I never get a response from the modem.

Obviously the windows diagnostics tool does something to initialise the
modem for responses - everything else works (the modem dials, etc.)

Any suggestions on how to "wake up" the modem without doing the diagnostics
every time?

Thanks
Etienne




More information about the Python-list mailing list