I'm running python -m SimpleHTTPServer 8888 from the directory my_serverand I want to access index.html file that contains a javascript command that reads my_file.csv, but the file is not in my_serveror one of its subfolders.
path/to/my_server $ ln -s /some_path/to/my_file.csv symbolic_link_to_my_file.csv
path/to/my_server $ python -m SimpleHTTPServer 8888
If I create a symbolic link inside my_server that points to my_file.csv and then access it like this:
http://localhost:8888/my_server/index.html?file=symbolic_link_to_my_file.csv
is there any way I could follow this symbolic link with javascript inside index.html to read my_file.csv?
<script>
//read URL params
...
d3.csv(file, ...)
</script>
Reading the docs on the
d3.csvcommand you need to send it a full URL. https://github.com/mbostock/d3/wiki/CSVWhat is the value of
filein thed3.csv(filecommand? If you're sending it something like "filename.csv", it may just be appending that to your current URL or current directory. You probably want to send it a full URL like this (with a slash at the beginning):/folder/myfile.csvIf you type this URL into your browser does it give you the CSV file?
http://localhost:8888/my_server/index.html?file=symbolic_link_to_my_file.csvIf it does then the contents of
fileshould probably be/my_server/index.html?file=symbolic_link_to_my_file.csv.