Edgewall Software
Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#13391 closed defect (cantfix)

AttributeError: 'bytes' object has no attribute 'encode'

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: general Version: 1.5.2
Severity: normal Keywords: pytz
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a GET operation on /prefs/localization, Trac issued an internal error.

The issue in ticket:13378 is related to the problem reported here. I am reporting this issue since there might be more similar issues related to porting to python3.

Request parameters:

{'panel_id': 'localization'}

User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0

System Information

Trac 1.5.2
Babel 2.5.1
Docutils 0.14
Jinja2 2.11.3
mod_wsgi 4.6.4 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
PostgreSQL server: 10.15, client: 12.4
psycopg2 2.7.5 (dt dec pq3 ext lo64)
Pygments 2.2.0
Python 3.6.8 (default, Aug 24 2020, 17:57:11)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
pytz 2017.2
setuptools 39.2.0
Subversion 1.14.1 (r1886195)
jQuery 1.12.4
jQuery UI 1.12.1
jQuery Timepicker 1.6.3

Enabled Plugins

Interface Customization

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/trac/web/main.py", line 609, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python3.6/site-packages/trac/web/main.py", line 301, in dispatch
    raise e
  File "/usr/local/lib/python3.6/site-packages/trac/web/main.py", line 248, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python3.6/site-packages/trac/prefs/web_ui.py", line 108, in process_request
    resp = chosen_provider.render_preference_panel(req, panel_id)
  File "/usr/local/lib/python3.6/site-packages/trac/prefs/web_ui.py", line 219, in render_preference_panel
    default_timezone = get_timezone(default_timezone_id) or localtz
  File "/usr/local/lib/python3.6/site-packages/trac/util/datefmt.py", line 1177, in get_timezone
    tz = pytz.timezone(to_unicode(tzname).encode('ascii', 'replace'))
  File "/usr/lib/python3.6/site-packages/pytz/__init__.py", line 158, in timezone
    zone = ascii(zone)
  File "/usr/lib/python3.6/site-packages/pytz/__init__.py", line 55, in ascii
    s.encode('ASCII') # Raise an exception if not ASCII
AttributeError: 'bytes' object has no attribute 'encode'

Attachments (0)

Change History (3)

comment:1 by Jun Omae, 3 years ago

Keywords: preferences added
Milestone: 1.5.3

Thanks for the reporting!

comment:2 by Jun Omae, 3 years ago

Keywords: pytz added; preferences removed
Milestone: 1.5.3
Resolution: cantfix
Status: newclosed

comment:3 by anonymous, 3 years ago

Great, that solved it for me. On CentOS 8, prefering to use the default package manager, I had to go through the hassle of upgrading to python 3.8 to be able to install a newer version of pytz.

Thanks for the hint.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.