Edgewall Software
Modify

Opened 5 months ago

Last modified 5 months ago

#13765 assigned defect

ImportError: attempted relative import with no known parent package

Reported by: pulkomandy@… Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: web frontend Version: 1.6
Severity: normal Keywords: fcgi
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I get this error when starting the fcgi server:

/usr/lib/python3/dist-packages/trac/web/fcgi_frontend.py:19: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/trac/web/fcgi_frontend.py", line 51, in <module>
    from ._fcgi import WSGIServer
ImportError: attempted relative import with no known parent package

I fixed the problem locally by changing the import to use an absolute path:

   from trac.web._fcgi import WSGIServer

This is with python 3.12 if that makes any difference.

Attachments (0)

Change History (1)

comment:1 by Jun Omae, 5 months ago

Keywords: fcgi added
Milestone: 1.6.1
Owner: set to Jun Omae
Status: newassigned

Thanks for the reporting.

Workaround is to run as a module instead a script:

$ python -m trac.web.fcgi_frontend

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Jun Omae.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.