Error when using gsd.hoomd.open

332 views
Skip to first unread message

Yuchen Xi

unread,
Apr 8, 2021, 10:31:17 AM4/8/21
to hoomd-users
Hi all

I trying to open a gsd file and extract particle position data. Below is the related script:

t = gsd.hoomd.open(name='1e7,gamma=1.gsd', mode='rb');
for i in range(len(t)):
    snap = t[i];
    np.savetxt('Conf' + str(i) + '.txt', snap.particles.position, fmt='%f', delimiter=',', newline='\n')  

I always get the error: OSError: [Errno 9] Bad file descriptor: '1e7,gamma=1.gsd'. I am pretty sure that the directory is right, and the gsd package is updated. Has anyone had the same issue before?

Thanks
Lawrence

Joshua Anderson

unread,
Apr 8, 2021, 5:04:33 PM4/8/21
to hoomd...@googlegroups.com
Lawrence,

gsd.hoomd.open will open files from your current working directory when you give it a relative path. I would expect this error if the file "1e7,gamma=1.gsd" does not exist in the current working directory.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/e3002c39-4dc4-4d4c-8812-e3635e7ce64an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages