GNOME Bugzilla – Bug 659342
Way to access files relative to the notebook
Last modified: 2018-07-10 22:06:06 UTC
Originally reported by Jon Kuhn as http://www.reinteract.org/trac/ticket/32 I use Reinteract to analyze CSV data files which are stored in the same directory as the script I am using to analyze them (or at least a path relative to the directory the script is stored in). Therefore, to load these CSV files it is useful for me to access the path the notebook file is stored in, in order to locate the associated CSV file. This patch allows the path of the notebook file to be accessed like this: __reinteract_notebook.get_path()[0] 08/10/08 22:57:26 changed by otaylor ==================================== No surprise, I think, that I'm not going to accept the patch in that form. :-) To begin with, I think I'd want something like notebook.set_data_path(), notebook.data_path rather than assuming that the first element in path is the place to find data files. But beyond that, I think that we should make this easy on the user, since it will likely be a common thing to do. Two ideas, not mutually exclusive * Override open in the worksheet's global scope with a function that resolves relative paths to the notebook. This clearly doesn't help if you are using a CVS-parsing library that wants a filename. * Make it more explicit: import reinteract.fileutils as fileutils filename = fileutils.find_file('foo.csv') or much simpler: * while the notebook is executing simply make the notebook's top level directory the current working directory for the script.
Created attachment 196820 [details] [review] Original patch
Reinteract is not under active development anymore and had its last code changes in early 2012: http://git.fishsoup.net/cgit/reinteract/log/ Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.