[IPython-dev] Absolute Path IPython

Lucien Boillod lucienboillod at gmail.com
Tue Sep 23 04:46:35 EDT 2014


Hi,

Sorry if I didn’t explain as well my problem. I have my documentation inside a folder, into a predefined path that I can call with a command (vcsn.datadir), in function where you are (when you open your Ipython notebook) the function return the correct path to access to the doc.
I would like to open some files in this folder ( this is .ipynb files) so I tried this :
import webbrowser
def doc(m):
    url = 'localhost:8888' + vcsn.datadir + '/notebooks/algos/' + m + '.ipynb'
    webbrowser.open(url)

doc(‘automaton.proper’)

But this isn’t work. Firstly because we are not obviously in the localhost 8888, it can be 8834 or whatever, but I don’t know how to catch the local host of our notebook session. Secondly because it seems not recognize this path, but if I go handly to this path there is the file, and I can open automaton.proper.ipynb.


Le 23 sept. 2014 à 09:43, Matthias Bussonnier <bussonniermatthias at gmail.com> a écrit :

> Hi Lucien, 
> 
> Can you give more context to what you are trying to achieve ? Like an example or a link to your project?
> Usually you should be able to use absolute path in IPython to read files. 
> 
> Cheers,
> -- 
> M
> 
> Envoyé de mon iPhone
> 
>> Le 23 sept. 2014 à 09:27, Lucien Boillod <lucienboillod at gmail.com> a écrit :
>> 
>> Hello,
>> 
>> Why can we not do a absolute path to find or read some files ? This is really a inconvenience because I would like the user can access, anywhere he is, to the documentation installed in a folder into my project, but without he has to find the way. But I can’t implement a magic_command line like “doc”, that open the file “index.ipynb” which is installed inside the project in a predefined path, because it’s not all allow absolute PATH.
>> So if you have a simple way to do my trick … 
>> 
>> Kindest regards
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list