Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't specify port with lpdtest.py #59

Open
skilfoy opened this issue Jan 30, 2022 · 2 comments
Open

Can't specify port with lpdtest.py #59

skilfoy opened this issue Jan 30, 2022 · 2 comments

Comments

@skilfoy
Copy link

skilfoy commented Jan 30, 2022

Whether I change the default port in the script from 515 to (for example) 30886 or if I specify the port in the bash command with the option --port 30886, I get the same error:

Traceback (most recent call last):
File "lpdtest.py", line 185, in
s.send(bytes("\002"+queue+"\n",'utf-8'))
TypeError: str() takes at most 1 argument (2 given)

If I don't specify the port, the script seems to fire off, although the print server is not on port 515, so nothing happens. But at least I don't get an error. The error only occurs when I specify the port.

Why does changing the port number make the script think that there's an additional argument? And how can this be fixed?

@0xWerz
Copy link

0xWerz commented Jun 8, 2022

you may just need to edit the script :D, specifically change the default variable at the line 48.
parser.add_argument("--port", type=int, help="printer port",default=30886 )

@unique-EJ
Copy link

unique-EJ commented Sep 19, 2022

File "./lpd/lpdtest.py", line 185 - TypeError.

  • Reserved shell word "in" ?
  • bytes("\002"+queue+"\n",'utf-8') - "takes at most 1 argument (2 given)"
$ python2
Python 2.7.18 (default, Jul  1 2022, 12:27:04) 
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> bytes("")
''
>>> bytes("\002")
'\x02'
>>> 
>>> bytes("\002"+"\n")
'\x02\n'
>>> bytes("\002"+"\n",'utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str() takes at most 1 argument (2 given)
>>> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants