pystore
pystore copied to clipboard
Strange path behaviour when using IPython terminal in Spyder
When I tried to follow the example in an IPython terminal (based from a non HOME location) using Spyder there was some strange behaviour.
pystore.set_path("~/pystore")
Creates a folder in the current working directory called ~/pystore
i.e. /path/to/my/files/~/pystore
rather than /home/user/pystore
When I execute the line:
collection.write('^GDAXI', data, metadata={'source': 'Yahoo'})
I get the error
FileNotFoundError: [Errno 2] No such file or directory: '~/pystore/mydatastore/tickers/^GDAXI/metadata.json'
This path is the correct unix filepath pointing to /home/user/pystore/mydatastore/tickers/^GDAXI/metadata.json
. The command does create the directory /home/user/pystore/mydatastore/tickers/^GDAXI/
and the parquet file, but the metadata file is located in the incorrect directory mentioned above.
I am not sure if this is something you want to look at, but there seems to be some variation in the way the paths are generated.
My simple repair (not backward compatible) is to alter the get_path
path function to return Path(config.DEFAULT_PATH, *args).expanduser()
, but this is incompatible with pathlib2