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 on EOS at CERN:
xrdcp foo.txt root://eospublic.cern.ch//eos/fcc/users/c/cbern/foo.txt
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 of this call in filesystem.py:
result = self.__fs.copy(source=source, target=target, force=force)[0]
First of all, self.__fs.copy returns a dictionary with strings as keys. Because it does not have integer 0 as a key, I'm getting a KeyError. Looking further, here is the dictionary:
{'status': 1, 'code': 9, 'ok': False, 'errno': 0, 'error': True, 'message': '[ERROR] Invalid arguments', 'fatal': False, 'shellcode': 50}
I think that instead of accessing the value of key 0, the code should first check whether ok is True.
If not, it should probably do something else.
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:
[xrootd-python]$ py.test
============================== test session starts ==============================
platform darwin -- Python 2.7.11, pytest-3.0.4, py-1.4.31, pluggy-0.4.0
rootdir: /Users/cbernet/Software/xrootd-python, inifile:
collected 48 items
tests/test_copy.py #stuck here ...
Could you please help?
Thanks,
Colin
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1