Discussion:
win32print
(too old to reply)
BartC
2015-07-01 08:59:49 UTC
Permalink
I need to print a text file to whatever printer in Windows is called
'Generic/Text Only'. I looked for a Python solution and come across Tim
Golden's win32print module which looks perfect, eg:

http://timgolden.me.uk/pywin32-docs/win32print.html

However, that tells me everything I need to know except how or where to
download it!

Is this something that actually can be downloaded somewhere? (Or is it
obsolete, or a project that I have to build myself? In which case it'll
probably be easier to write my own Win32 code but I was trying to avoid
that.)
--
Bartc
Mark Lawrence
2015-07-01 10:15:00 UTC
Permalink
Post by BartC
I need to print a text file to whatever printer in Windows is called
'Generic/Text Only'. I looked for a Python solution and come across Tim
http://timgolden.me.uk/pywin32-docs/win32print.html
However, that tells me everything I need to know except how or where to
download it!
Is this something that actually can be downloaded somewhere? (Or is it
obsolete, or a project that I have to build myself? In which case it'll
probably be easier to write my own Win32 code but I was trying to avoid
that.)
That's the standard pywin32 docs that happen to be on Tim's site. Get
the latest pywin32 here
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence
BartC
2015-07-01 11:02:36 UTC
Permalink
Post by Mark Lawrence
Post by BartC
I need to print a text file to whatever printer in Windows is called
'Generic/Text Only'. I looked for a Python solution and come across Tim
http://timgolden.me.uk/pywin32-docs/win32print.html
However, that tells me everything I need to know except how or where to
download it!
That's the standard pywin32 docs that happen to be on Tim's site. Get
the latest pywin32 here
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Yes, I ended up there at one point, but didn't see a win32print.py file,
only a win32print.cpp one. I think messing about with C++ compilers and
makefiles (that never work properly under Windows) defeats the object of
trying to use Python for this purpose!

Presumably, nowhere on the internet is there a ready-to-use copy of
win32print.py that someone else could just download with little effort?

(Anyway, never mind; I'm looking at a solution now that involves
invoking Windows' rundll32 and notepad to do the job. And it saves the
problem of instructing someone on the end of a telephone how to install
even Python let alone locating the add-ons.

This is task that, in the eighties, would have involved sending a
string, a byte at a time, to the parallel port, perhaps 3 lines of code.
It's great that in 2015 everything is so much simpler!)
--
Bartc
Tim Golden
2015-07-01 11:28:10 UTC
Permalink
Post by BartC
Post by Mark Lawrence
Post by BartC
I need to print a text file to whatever printer in Windows is called
'Generic/Text Only'. I looked for a Python solution and come across Tim
http://timgolden.me.uk/pywin32-docs/win32print.html
However, that tells me everything I need to know except how or where to
download it!
That's the standard pywin32 docs that happen to be on Tim's site. Get
the latest pywin32 here
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Yes, I ended up there at one point, but didn't see a win32print.py file,
only a win32print.cpp one. I think messing about with C++ compilers and
makefiles (that never work properly under Windows) defeats the object of
trying to use Python for this purpose!
Presumably, nowhere on the internet is there a ready-to-use copy of
win32print.py that someone else could just download with little effort?
(Anyway, never mind; I'm looking at a solution now that involves
invoking Windows' rundll32 and notepad to do the job. And it saves the
problem of instructing someone on the end of a telephone how to install
even Python let alone locating the add-ons.
This is task that, in the eighties, would have involved sending a
string, a byte at a time, to the parallel port, perhaps 3 lines of code.
It's great that in 2015 everything is so much simpler!)
If I can interrupt your Jeremiad for a moment, this page might help:

http://timgolden.me.uk/python/win32_how_do_i/print.html

and it (and the docs you found above) relies on this download page:

http://sourceforge.net/projects/pywin32/files/pywin32/

which, as you can see, has been available for every then-valid version
of Python for some years now.

TJG
BartC
2015-07-01 13:10:27 UTC
Permalink
Post by Tim Golden
Post by BartC
Yes, I ended up there at one point, but didn't see a win32print.py file,
Presumably, nowhere on the internet is there a ready-to-use copy of
win32print.py that someone else could just download with little effort?
http://timgolden.me.uk/python/win32_how_do_i/print.html
http://sourceforge.net/projects/pywin32/files/pywin32/
which, as you can see, has been available for every then-valid version
of Python for some years now.
OK, thanks, that now works. (I need to click on a .exe file not on .zip,
and choose a version that corresponds with what's in the registry, which
was 3.1 in my case, not 3.12 nor 3.4 which are also installed.

This would be a better basis for solving the problem (driving a bar-code
printer). Although it's still not certain how I might distribute the
result (just copy the whole directory Python 3.1 tree onto a memory
stick perhaps and send that).
--
Bartc
Dennis Lee Bieber
2015-07-01 13:17:45 UTC
Permalink
Post by BartC
Yes, I ended up there at one point, but didn't see a win32print.py file,
only a win32print.cpp one. I think messing about with C++ compilers and
makefiles (that never work properly under Windows) defeats the object of
trying to use Python for this purpose!
So far as I know, there is no "win32print.py" file... The functions are
part of the win32 /library/, which is a compiled DLL (the file you found
sounds like it may have been the source file for part of the library).
--
Wulfraed Dennis Lee Bieber AF6VN
***@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Continue reading on narkive:
Loading...