[Tutor] Single Backslash (was 'DOS Commands?')
James.Rocks@equant.com
James.Rocks@equant.com
Mon Nov 11 06:12:01 2002
Hi Danny, Magnus,
OK ... I've got it to work BUT I still get an error. The following is my
program:
from time import *
from os import popen
sUnique = "%s%s%s%s%s%s%s%s%s" % localtime()
sSMSFile = "c:\\temp\\%s.CTXScanner.%s" % (sUnique, '447771767405')
sDOSCommand = "ncftpput -u ****** -p ****** ******.lon.globalone.net
sms c:\\temp\\%s.CTXScanner.%s" % (sUnique, '447771767405')
fSMSFile = open (sSMSFile, "w")
fSMSFile.write('Frm: CTX Scan\nSrv: %s\nSts: %s' % ('LONASMEG01', 'DN
15 Min'))
fSMSFile.close()
popen(sDOSCommand, 'w').readlines()
Though the SMS server does send a message to my mobile, I get the following
error message:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "c:\projects\ctx\smstest.py", line 13, in ?
popen(sDOSCommand, 'w').readlines()
IOError: [Errno 9] Bad file descriptor
And the value of sDOSCommand is:
'ncftpput -u ****** -p ****** ******.lon.globalone.net sms c:
\\temp\\2002111110594503150.CTXScanner.447771767405'
>From what I can tell the file creation bit works fine but the DOS command,
though it works, causes an error. Maybe the problem is using the freeware
NcFTP program and running it through DOS but an error like this would crash
my program wouldn't it? On the plus side I have discovered that Python has
an FTP module so I'm going to investigate that and maybe keep it 'in house'
(so to speak) :-)
James
James C. Rocks
Equant
Archway House
Canary Wharf
London E14 9SZ