nglviewer / mdsrv

MD trajectory server
http://arose.github.io/mdsrv/
Other
36 stars 10 forks source link

[Error] Deprecated MDsrv function "get_frame_string" of trajectory.py used in Python 3.9 #57

Closed adriangarciarecio closed 1 year ago

adriangarciarecio commented 1 year ago

Hi.

I am working with the server implementation of mdsrv using the version python 3.9 (MDsrv --> 0.3.5.post1). I load the trajectories without problems, but when I want to run a trajectory (play button) nothing happens. I think that one of the functions on the script "trajectory.py" named "get_frame_string" uses a deprecated function named ".tostring()". I think that Python 3.9 needs the equivalent ".tobytes()" function to work.

I attach the log file:

"""" [Thu Feb 09 17:00:59.256577 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] ERROR:mdsrv.mdsrv:Exception on /traj/frame/850/_DB/Dynamics/10398_trj_36.xtc [POST] [Thu Feb 09 17:00:59.256612 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] Traceback (most recent call last): [Thu Feb 09 17:00:59.256619 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app [Thu Feb 09 17:00:59.256627 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] response = self.full_dispatch_request() [Thu Feb 09 17:00:59.256634 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/flask/app.py", line 1519, in full_dispatch_request [Thu Feb 09 17:00:59.256640 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] rv = self.handle_user_exception(e) [Thu Feb 09 17:00:59.256646 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/flask/app.py", line 1517, in full_dispatch_request [Thu Feb 09 17:00:59.256653 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] rv = self.dispatch_request() [Thu Feb 09 17:00:59.256659 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/flask/app.py", line 1503, in dispatch_request [Thu Feb 09 17:00:59.256666 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] return self.ensure_sync(self.view_functions[rule.endpoint])(req.view_args) [Thu Feb 09 17:00:59.256672 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/mdsrv/mdsrv.py", line 91, in decorated [Thu Feb 09 17:00:59.256679 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] return f( *args, *kwargs ) [Thu Feb 09 17:00:59.256685 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/mdsrv/mdsrv.py", line 139, in wrapped_function [Thu Feb 09 17:00:59.256692 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] resp = make_response( f( args, kwargs ) ) [Thu Feb 09 17:00:59.256698 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/mdsrv/mdsrv.py", line 299, in traj_frame [Thu Feb 09 17:00:59.256705 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] return TRAJ_CACHE.get( path, struc_path ).get_frame_string( [Thu Feb 09 17:00:59.256711 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] File "/opt/gpcrmdenv/lib/python3.9/site-packages/mdsrv/trajectory.py", line 168, in get_frame_string [Thu Feb 09 17:00:59.256718 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] array.array( "i", [ frame[ "numframes" ] ] ).tostring() + [Thu Feb 09 17:00:59.256724 2023] [wsgi:error] [pid 280222:tid 139676249474816] [remote 172.20.16.173:33150] AttributeError: 'array.array' object has no attribute 'tostring' """ Any suggestion?

Thanks, Adrián.

adriangarciarecio commented 1 year ago

[SOLVED] I changed manually all the tostrings() by tobytes() and all works fine.

j0kaso commented 1 year ago

Thanks a lot Adrián for the fix! Maybe our new mdsrv update using mol* is also of interest for you: https://github.com/dwiegreffe/mdsrv