Skip to content

PermissionError with system-wide spoon install #4

@wvengen

Description

@wvengen

On a Linux system, when you install spoon, it raises a PermissionError on the logfile on loading.

  1. pip3 install spoonproxy
  2. any code loading e.g. the Manager will raise an error
    example: python3 -m spoon_server.main.manager

The following error is raised:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/spoon_server/main/manager.py", line 5, in <module>
    from spoon_server.proxy.fetcher import Fetcher
  File "/usr/local/lib/python3.7/dist-packages/spoon_server/proxy/fetcher.py", line 2, in <module>
    from spoon_server.proxy.ip3366_provider import IP3366Provider
  File "/usr/local/lib/python3.7/dist-packages/spoon_server/proxy/ip3366_provider.py", line 2, in <module>
    from spoon_server.util.html_parser import get_html_tree
  File "/usr/local/lib/python3.7/dist-packages/spoon_server/util/html_parser.py", line 6, in <module>
    from spoon_server.util.logger import log
  File "/usr/local/lib/python3.7/dist-packages/spoon_server/util/logger.py", line 10, in <module>
    log_file_handler = TimedRotatingFileHandler(filename=os.path.join(log_path, "spoon.log"), when="D", interval=1)
  File "/usr/lib/python3.7/logging/handlers.py", line 199, in __init__
    BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
  File "/usr/lib/python3.7/logging/handlers.py", line 54, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.7/logging/__init__.py", line 1092, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.7/logging/__init__.py", line 1121, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/spoon_server/spoon.log'

This looks like a debugging left-over. I'd suggest to specify no default logging output, but leave that to the user of this package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions