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

lnst-slave deamonize parameter does not work on python3 #191

Open
jtluka opened this issue Oct 11, 2018 · 2 comments
Open

lnst-slave deamonize parameter does not work on python3 #191

jtluka opened this issue Oct 11, 2018 · 2 comments
Labels

Comments

@jtluka
Copy link
Collaborator

jtluka commented Oct 11, 2018

[root@localhost ~]# lnst-slave -e
Loading config file '/etc/lnst-slave.conf'
2018-10-11 11:22:12       (localhost)        -    INFO: Started
2018-10-11 11:22:12       (localhost)        -    INFO: Using RPC port 9999.
Traceback (most recent call last):
  File "/usr/local/bin/lnst-slave", line 102, in <module>
    main()
  File "/usr/local/bin/lnst-slave", line 98, in main
    daemon.daemonize()
  File "/usr/local/lib/python3.6/site-packages/lnst/Common/Daemon.py", line 56, in daemonize
    pid = self._read_pid()
  File "/usr/local/lib/python3.6/site-packages/lnst/Common/Daemon.py", line 28, in _read_pid
    handle = file(self._pidfile, "r")
NameError: name 'file' is not defined

Replacing 'file' with 'open' should fix the issue.

@jtluka jtluka added the bug label Oct 11, 2018
@antonioromito
Copy link

I get this on my FC31.

# lnst-slave -e
Loading config file '/etc/lnst-slave.conf'
2019-11-25 17:43:21       (localhost)        -    INFO: Started
2019-11-25 17:43:21       (localhost)        -    INFO: Using RPC port 9999.
2019-11-25 17:43:21       (localhost)        -    INFO: deamonized with pid 433188
Traceback (most recent call last):
  File "/usr/local/bin/lnst-slave", line 4, in <module>
    __import__('pkg_resources').run_script('lnst===14-8d972d0f5098b5d635677aa3af15234b9a06ea01', 'lnst-slave')
  File "/root/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/root/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1453, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.7/site-packages/lnst-14_8d972d0f5098b5d635677aa3af15234b9a06ea01-py3.7.egg/EGG-INFO/scripts/lnst-slave", line 102, in <module>
    main()
  File "/usr/local/lib/python3.7/site-packages/lnst-14_8d972d0f5098b5d635677aa3af15234b9a06ea01-py3.7.egg/EGG-INFO/scripts/lnst-slave", line 98, in main
    daemon.daemonize()
  File "/usr/local/lib/python3.7/site-packages/lnst-14_8d972d0f5098b5d635677aa3af15234b9a06ea01-py3.7.egg/lnst/Common/Daemon.py", line 91, in daemonize
    se = open("/dev/null", 'a+', 0)
ValueError: can't have unbuffered text I/O

@jtluka
Copy link
Collaborator Author

jtluka commented Nov 26, 2019

Hi Antonio. I get the same on Fedora 29.

It seems that buffering cannot be set for files opened in text mode in python3. The documentation says that it's possible to set line buffering instead (buffering=1).

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

No branches or pull requests

2 participants