0 votes
1 view
I'm trying to figure out how to read a large FITS file and am hoping Data Lab could provide a method. So far I haven't found a way to do it and I seem to be further away than I was yesterday. I have some files that I uploaded to my VOspace, most of them just for tests. I can still see them with the file browser on the left side of the jupyterlab interface, or with %ls vospace/ at a python console. But if I do sc.ls() or sc.ls(name='vos://') I get 'Error 403: "vos://" FORBIDDEN'. I'm pretty sure that was working yesterday, although I have logged out of the consoles where I was working so can't confirm. Is there something wrong with my account?
ago by fardal (140 points) | 1 view
Or do I need to use an authentication token? I didn't need one yesterday, and I think I was doing similar things successfully.

1 Answer

0 votes

In most cases when using the store client you need to provide a valid token. Sometimes
the token is implicitly provided which might explain why it worked previously.

To upload a file to VOSpace you can use the `put` method:
sc.put(fr='example.txt',to='example-vos-folder/example.txt')

If you are in a notebook you may need to re run the `login` method. See a common
example below:

token = ac.login(input("Enter user name: (+ENTER) "),getpass("Enter password: (+ENTER) "))

You can find a complete example of using store client in the notebooks provided
by Data Lab: https://github.com/astro-datalab/notebooks-latest/blob/master/04_HowTos/StoreClient/How_to_use_the_Data_Lab_StoreClient.ipynb.

ago by cmyers (240 points)
Thanks! sc.ls seems to be working with the token now. I was fiddling with sc for quite a while yesterday and it never required one.
And now it is back to not needing a token. How fickle!
We can look into improving this in the future, the behavior is a bit odd. For now you could explicitly pass your token to the method which might things more clear such as:
storeClient.ls(token, "vos://")

Additionally, you can verify your token is still valid before calling `ls` to avoid some of the inconsistencies:
authClient.isTokenLoggedIn(token)

486 questions

496 answers

489 comments

677 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.

Categories