Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1323 closed defect (fixed)

Session restore of color name: tuple indices must be integers or slices, not str

Reported by: Elaine Meng Owned by: Tom Goddard
Priority: normal Milestone: 0.9
Component: Sessions Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Darwin-17.7.0-x86_64-i386-64bit
ChimeraX Version: 0.8 (2018-09-15)
Description
cannot restore session with custom color name

I opened some structure (doesn't matter, may not even need any structure) and defined a new color, e.g. command:

color name blorg 80,80,50

... then saved session.  Trying to restore session gives the traceback in the Log.

Log:
UCSF ChimeraX version: 0.8 (2018-09-15)  
How to cite UCSF ChimeraX  

open /Users/meng/Desktop/blorg.cxs format session ↵

Summary of feedback from opening /Users/meng/Desktop/blorg.cxs  
---  
error | Unable to restore session, resetting.  
  
Traceback (most recent call last):  
File
"/Users/meng/Desktop/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/chimerax/core/session.py", line 584, in restore  
obj = sm.restore_snapshot(self, data)  
File
"/Users/meng/Desktop/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/chimerax/core/colors.py", line 178, in restore_snapshot  
return Color(data['rgba'], limit=False)  
TypeError: tuple indices must be integers or slices, not str  
  
opened ChimeraX session  

toolshed show "Bug Reporter"




OpenGL version: 4.1 INTEL-10.36.19
OpenGL renderer: Intel Iris Pro OpenGL Engine
OpenGL vendor: Intel Inc.

Change History (5)

comment:1 by Eric Pettersen, 7 years ago

Component: UnassignedInput/Output
Milestone: 0.9
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionSession restore of color name: tuple indices must be integers or slices, not str

take_snapshot returns (version, dict); restoe_snapshot treats that tuple as a dictionary

comment:2 by Eric Pettersen, 7 years ago

Component: Input/OutputSessions

comment:3 by Tom Goddard, 7 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

Named color session save added by Greg saved the data as a tuple instead of a dictionary and later restore code changes assumed it was a dictionary since almost all session code saves data in dictionaries.

comment:4 by Tom Goddard, 7 years ago

Sessions saved with named colors before today's fix will still give an error. If older sessions need to be restored I can improve the code to handle the older sessions with named colors.

in reply to:  5 ; comment:5 by Elaine Meng, 7 years ago

I personally don’t need to restore older sessions with named colors.  I only found this bug by specifically testing whether custom colors were included in sessions, so unless other users protest, I’d say it’s not important to go the extra mile.
Note: See TracTickets for help on using tickets.