Data output
Emile van Sebille
emile at fenx.com
Wed Jan 24 11:58:34 EST 2001
Here are some excerpts from a zope based label printing
utility I set up last year under winnt work station:
if REQUEST.printLoc == "California":
printerID = r"\\nova104\weber"
printerDevice = "LPT2"
outFile = r'f:\CA_Label.txt'
batFile = r'f:\CA_Label.cmd'
elif REQUEST.printLoc == "Illinois":
printerID = r"\\shipping\webera1"
printerDevice = "LPT3"
outFile = r'f:\IL_Label.txt'
batFile = r'f:\IL_Label.cmd'
elif REQUEST.printLoc == "None":
printerID = r"\\fclt\weber"
printerDevice = "LPT2"
outFile = r'f:\FX_Test.txt'
batFile = r'f:\FX_Test.cmd'
######### and the later....
osCommands = [('net use %s: /DELETE' % (printerDevice,)),
('net use %s: %s /PERSISTENT:YES' % (printerDevice,
printerID)),
('copy %s %s:' % (outFile, printerDevice))]
if problems:
return string.join(problems,'\n')
else:
printer.flush()
printer.close()
batch = open(batFile, 'w')
for eachCommand in osCommands:
batch.write("%s\n" % eachCommand)
batch.flush()
batch.close()
os.system(batFile)
if REQUEST.printLoc == "None":
return
"Submitted!\n\nReprinted:%s\n\nSequences:%s\n\nLines:%s\n\nR
EQUEST:%s" % (repr(rePrintSeqs), repr(assignedSeqs),
db_repr(lines), repr(REQUEST))
else:
return "Submitted!"
Hope this makes sense. :-)
--
Emile van Sebille
emile at fenx.com
-------------------
"Oliver Vecernik" <vecernik at aon.at> wrote in message
news:3A6F05CD.D37C383B at aon.at...
> Hi all,
>
> I recently started using Python and I like it a lot.
> I'd like to control label printers. I know how to control
them, but I
> don't know how to output data on Win XX or Linux machines
to network
> printers.
> I don't want any windows driver to convert anything (like
adding
> formfeeds, newlines or whatever).
>
> Can anyone give my a clue or point me to some
documentation?
>
> Thanks.
> Oliver
More information about the Python-list
mailing list