Possible to set printer devmode using samba3-python?

Kurt Pfeifle kpfeifle at danka.de
Tue Nov 11 21:52:47 GMT 2003

> Possible to set printer devmode using samba3-python?
>     * To: samba-technical at listsdotsambadotorg
>     * Subject: Possible to set printer devmode using samba3-python?
>     * From: danieldotjarboe at custservdotcom
>     * Date: Tue, 11 Nov 2003 15:54:15 -0500
> Is it possible to retrieve/set a printer's devmode using the samba3
> python helpers?

A valid *devmode* can only be set (if it needs to be set) by *executing*
the Windows binaries of the Windows printer driver. That execution is
only possible by opening the driver properties from a Windows client,
thusly causing a client-side driver execution.

It suffices to change (f.e.) the page mode from "portrait" to "landscape",
then "Apply", then back again to have that Windows code executed once
(on the Windows client), and then loaded back a valid device mode onto
the (Samba) server.

But maybe I don't understand your intention?

What is the "samba3-python" thing you are talking about?

Maybe you are intending to address the setting of user-selectable printjob
options to certain defaults (and not setting a "DeviceMode" which is s.th.

> I'm trying to automate printer driver installation on samba servers for
> Our print admin.  I've no problem getting the driver files from a
> windows
> printer shared with rpcclient and smbclient, and access printerdata to
> set things like installed printer accessories...

But you're doing that from the Windows client? Or?

> But in order to have the printing preferences and defaults set I believe
> I need getprinter and setprinter.
> Getprinter seems to work well, but when doing a python spoolss
> setprinter for info2, I get:
> spoolss.werror: [31, 'DOS code 0x0000001f'] ...
> And when doing a setprinter(info1) I get segmentation fault.
> backtrace of core yields:
> #0  0x40322688 in prs_uint32 ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #1  0x40372806 in spool_io_printer_info_level_1 ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #2  0x403732a0 in spool_io_printer_info_level ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #3  0x4037129e in spoolss_io_q_setprinter ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #4  0x4038c43e in cli_spoolss_setprinter ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #5  0x402bcbd4 in spoolss_hnd_setprinter ()
>    from /usr/lib/python2.2/lib-dynload/samba/spoolss.so
> #6  0x00490162 in PyCFunction_Call ()
> #7  0x0046fe68 in PyObject_Call ()
> #8  0x00439b7a in PyEval_GetFuncDesc ()
> For setprinter(info3) I get:
> spoolss.error: error converting to printer info 3 ... 
> That is with info3=hnd.getprinter(level=3) ... I made no modifications
> to
> the format of the data.
> Is samba3 python not ready for what I'm trying to do?  Any ideas how I
> can accomplish it by other means? 

Please explain, in simple words, to a dumb little documentation writer
what exactly you want to achieve.

> This is with 3.0.1pre2 on SLES8 s/390,
> with a w2k pc on the other end.
> Thanks,
> ~ Daniel

More information about the samba-technical mailing list