Bug 64616 - No way to change default printer in a script
No way to change default printer in a script
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: printconf (Show other bugs)
7.2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-08 13:43 EDT by Neal Gafter
Modified: 2007-04-18 12:42 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-05-16 10:41:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Neal Gafter 2002-05-08 13:43:51 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc1) Gecko/20020417

Description of problem:
There is no way to change the default printer in a script.
This is necessary, for example, for a laptop that is used
on multiple networks; I want the startup files to detect which
network we are currently plugged into and change the default
printer to one apropriate for that network.

The two obvious ways of doing this don't work because of
bugs in printconf-tui.  Specifically
    printconf-tui --force -Ximport < saved
doesn't change the default printer.  Similarly
    printconf-tui --Xdefault --queue=foo
crashes the printconf system with the following message

Traceback (innermost last):
  File "/usr/sbin/printconf-tui", line 8, in ?
    printconf_tui.startup_and_find_cmd()
  File "/usr/share/printconf/util/printconf_tui.py", line 2059, in
startup_and_find_cmd
    main.cmd_handlers[cmd]()
  File "/usr/share/printconf/util/printconf_tui.py", line 2019, in default_cmd_run
    if not valid_queue_name(queue_name):
  File "/usr/share/printconf/util/printconf_conf.py", line 1262, in valid_queue_name
    return re.match(r'^[a-zA-Z][-a-zA-Z0-9_]*$', name)
  File "/usr/lib/python1.5/re.py", line 40, in match
    return _cachecompile(pattern, flags).match(string)
  File "/usr/lib/python1.5/re.py", line 117, in match
    endpos=len(string)
TypeError: len() of unsized object


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. printconf-tui --Xdefault --queue=laser
2.
3.
	

Actual Results:  Traceback (innermost last):
  File "/usr/sbin/printconf-tui", line 8, in ?
    printconf_tui.startup_and_find_cmd()
  File "/usr/share/printconf/util/printconf_tui.py", line 2059, in
startup_and_find_cmd
    main.cmd_handlers[cmd]()
  File "/usr/share/printconf/util/printconf_tui.py", line 2019, in default_cmd_run
    if not valid_queue_name(queue_name):
  File "/usr/share/printconf/util/printconf_conf.py", line 1262, in valid_queue_name
    return re.match(r'^[a-zA-Z][-a-zA-Z0-9_]*$', name)
  File "/usr/lib/python1.5/re.py", line 40, in match
    return _cachecompile(pattern, flags).match(string)
  File "/usr/lib/python1.5/re.py", line 117, in match
    endpos=len(string)
TypeError: len() of unsized object


Expected Results:  This should have changed the default printer queue.

Additional info:

There is no workaround.  That is, there is no other way to change
the default printer.
Comment 1 Tim Waugh 2002-05-16 10:40:35 EDT
Fixed in CVS.
Comment 2 Tim Waugh 2002-05-21 11:39:19 EDT
Fixed in 0.3.78-1.

Note You need to log in before you can comment on or make changes to this bug.