Opened 6 years ago

Closed 6 years ago

#2619 closed defect (fixed)

trying to open GLTF: ImportError: cannot import name 'surface' from 'chimerax.core'

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

Description

I was trying to see if GLTF would save/restore colors of blobs colored with "Measure and Color Blobs" since they are not preserved in session files. However, trying to open the attached file gave a traceback. Example commands and Log feedback, current daily buildUCSF ChimeraX version: 0.91 (2019-11-27):

open 1zik
show
molmap aromatic 8
ui mousemode rightMode "pick blobs"
measure blob #!2.1 triangleNumber 505 color #6073ceff outline trueSurface 1zik map 8 #2.1 blob:
volume = 1343.5
area = 743.31
size = 21.948 11.853 10.317

measure blob #!2.1 triangleNumber 543 color #31d386ff outline trueSurface 1zik map 8 #2.1 blob:
volume = 1381.5
area = 743.41
size = 22.486 12.158 10.435

save blubber.glb
close
open blubber.glbTraceback (most recent call last):

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/cmd_line/tool.py", line 258, in execute

cmd.run(cmd_text)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2837, in run

result = ci.function(session, kw_args)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 68, in open

path_models = session.models.open(paths, format=format, name=name, kw)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/models.py", line 700, in open

session, filenames, format=format, name=name, kw)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/io.py", line 489, in open_multiple_data

models, status = open_data(session, fspec, format=format, name=name, kw)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/io.py", line 445, in open_data

models, status = open_func(*args, kw)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/gltf/init.py", line 31, in open_file

return gltf.read_gltf(session, stream, file_name)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/gltf/gltf.py", line 70, in read_gltf

mesh_drawings = meshes_as_models(session, jmeshes, ba)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/gltf/gltf.py", line 185, in meshes_as_models

from chimerax.core import surface

ImportError: cannot import name 'surface' from 'chimerax.core' (/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/init.py)

ImportError: cannot import name 'surface' from 'chimerax.core' (/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/init.py)

File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/gltf/gltf.py", line 185, in meshes_as_models
from chimerax.core import surface

Attachments (1)

blubber.glb (20.6 MB ) - added by Elaine Meng 6 years ago.

Change History (2)

by Elaine Meng, 6 years ago

Attachment: blubber.glb added

comment:1 by Tom Goddard, 6 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

GLTF code was importing surface module which moved about a year ago. Error only happened when GLTF code tries to compute surface normals from triangles -- maybe that is not so common, or maybe no one read gltf in the last year.

Note: See TracTickets for help on using tickets.