Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make wobj.py Python3 Compatible #12

Closed
Inniag opened this issue Aug 27, 2019 · 6 comments
Closed

Make wobj.py Python3 Compatible #12

Inniag opened this issue Aug 27, 2019 · 6 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@Inniag
Copy link
Collaborator

Inniag commented Aug 27, 2019

The PyMol script for loading OBJ files is currently not compatible with the Python3 standard. This might cause errors such as this:

PyMOL>run visualise_pathway.py,main
Traceback (most recent call last):
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 487, in run
    run_(path, ns_main, ns_main)
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 532, in run_file
    execfile(file,global_ns,local_ns)
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 527, in execfile
    exec(co, global_ns, local_ns)
  File "visualise_pathway.py", line 89, in <module>
    obj = wobj.import_wobj(args.surface)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 396, in import_wobj
    return obj_importer.read(filename)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 182, in read
    cgo[key] = self.__create_cgo_object(key)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 348, in __create_cgo_object
    vertex_a = self.__vertices[face["vert_idx"][0] - 1]
TypeError: 'map' object is not subscriptable

A fix has already been suggested in issue #11.

@Jeffatcunyc
Copy link

Hi Inniag,

I could not find the answer to the loading OBJ file issue with PyMol running on Python3. Could you please give me more details about how to fix it up? Thanks.

Jeff

@Jeffatcunyc
Copy link

Hi Inniag,

I just worked it out. My solution was using an old version of PyMol running on Python2. What I used is PyMol 1.8.4.0.

Best,
Jeff

@Inniag Inniag self-assigned this Sep 18, 2019
@Inniag Inniag added enhancement New feature or request bug Something isn't working labels Sep 18, 2019
@calvadia
Copy link

I have the same error message. Any fix available yet?

Thank you,
Carolina

@DSeiferth
Copy link
Collaborator

In Python 3, " map" returns an iterable object of type map, and not a subscriptible list.
If you replace every map() with list(map()) in wobj.py, the script is python3 compatible.
For example replace
self.__materials[self.__crnt_material]["Ka"] = map(float, split_line[1:4])
with
self.__materials[self.__crnt_material]["Ka"] = list(map(float, split_line[1:4]))

@DSeiferth
Copy link
Collaborator

I did not see the pull request made by irudayaf on 28 Aug 2019 in which he basically did the same...

channotation added a commit that referenced this issue Dec 14, 2021
 Make wobj.py Python3 Compatible #12
@channotation
Copy link
Owner

Closed pull request #13 from @irudayaf as well now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants