the source package xrootd-4.5.0.tar.gz comes with pyxrootd so at first I tried to use this version. It didn't work for the reasons explained below, and I then tried v0.3.0 of this repository.
Following the instructions given in the documentation, I wrote the following tests:
import unittest
from XRootD import client
from XRootD.client.flags import DirListFlags, OpenFlags, MkDirFlags, QueryCode
myclient = client.FileSystem('root://eospublic.cern.ch/:1094')
remote_dir = '/eos/fcc/users/c/cbern/Test/'
remote_file = remote_dir + '/foo'
class TestXROOTD(unittest.TestCase):
def test_listdir(self):
status, listing = myclient.dirlist(remote_dir, DirListFlags.STAT)
self.assertTrue(status.ok)
self.assertEqual(listing.parent, remote_dir)
def test_1_copy_in(self):
status = myclient.copy(remote_file, 'foo', force=True)
self.assertTrue(status.ok)
if __name__ == '__main__':
unittest.main()
The first test works and the second fails because, in filesystem.py, this call fails:
result = self.__fs.copy(source=source, target=target, force=force)[0]
First of all, self.__fs.copy returns a dictionary, and this dictionary has strings as keys. It does not have integer 0 as a key which leads to a KeyError in my case. Looking further, here is the dictionary:
Why is the code trying to access element 0?
What am I doing wrong? the message '[ERROR] Invalid arguments' is not enough for me to understand what's going on, and the debugger does not help. As far as I can see, I just copied the lines in the documentation, http://xrootd.org/doc/python/xrootd-python-0.1.0/examples/filesystem.html
Finally, I tried to run py.test, but it gets stuck here:
Hello,
I'm trying to use pyxrootd on mac os x sierra. I have installed xrootd 4.5.0 and I'm able to copy a file to a remote location:
the source package xrootd-4.5.0.tar.gz comes with pyxrootd so at first I tried to use this version. It didn't work for the reasons explained below, and I then tried v0.3.0 of this repository.
Following the instructions given in the documentation, I wrote the following tests:
The first test works and the second fails because, in filesystem.py, this call fails:
First of all, self.__fs.copy returns a dictionary, and this dictionary has strings as keys. It does not have integer 0 as a key which leads to a KeyError in my case. Looking further, here is the dictionary:
Why is the code trying to access element 0? What am I doing wrong? the message '[ERROR] Invalid arguments' is not enough for me to understand what's going on, and the debugger does not help. As far as I can see, I just copied the lines in the documentation, http://xrootd.org/doc/python/xrootd-python-0.1.0/examples/filesystem.html
Finally, I tried to run py.test, but it gets stuck here:
Could you please help?
Thanks, Colin