After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659342 - Way to access files relative to the notebook
Way to access files relative to the notebook
Status: RESOLVED WONTFIX
Product: reinteract
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: reinteract-maint
reinteract-maint
gnome[unmaintained]
Depends on:
Blocks:
 
 
Reported: 2011-09-17 19:11 UTC by Owen Taylor
Modified: 2018-07-10 22:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Original patch (1.17 KB, patch)
2011-09-17 19:12 UTC, Owen Taylor
none Details | Review

Description Owen Taylor 2011-09-17 19:11:33 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.
Comment 1 Owen Taylor 2011-09-17 19:12:18 UTC
Created attachment 196820 [details] [review]
Original patch
Comment 2 André Klapper 2018-07-10 22:06:06 UTC
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.