Notification texts go here Contact Us Buy Now!

Python27(win): import daemon, but there is an error: No module named pwd

  1. The pwd module is a UNIX-only package responsible for managing passwords.

  2. The package you are attempting to install, daemon, is an unmaintained package from 2014. A more recent and well-maintained package called python-daemon is available for implementing daemons in UNIX systems. However, it is not compatible with Windows.

  3. If you are developing an application and want to achieve similar functionality on Windows, you need to install it as a service, not a daemon. This Stack Overflow post provides relevant information on how to proceed, despite being somewhat outdated.

Another Solution:

Both python-daemon (newer version) and daemon require the pwd package, which is unavailable on Windows. To address this issue, your code should detect the absence of pwd and disable the daemon mode on Windows, where it is not applicable.

try:
    import daemon
except ImportError:
    daemon = None

You can then check if daemon is None later in your code.

Experiences from Other Users:

  • One user encountered a similar error with the getpass module. The issue was resolved by repairing the Python installation through the installer.
  • Another user suggested commenting out the import pwd line in pebblo.py to avoid using the pwd module for fetching the owner's name.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.