https://bugs.kde.org/show_bug.cgi?id=358975
Bug ID: 358975 Summary: Make the worksheet path available to backends (enhancement proposal with patch) Product: cantor Version: unspecified Platform: unspecified OS: All Status: UNCONFIRMED Severity: wishlist Priority: NOR Component: general Assignee: fil...@kde.org Reporter: mat...@dnet.it CC: alexanderrie...@gmail.com It is sometimes needed to access the worksheet path from the backend code. Specifically, I am trying to access the path information from Sage code: for example to include a separate script, or to write results to file. If the current path is not known, then absolute paths must be hardcoded in the worksheet, which might not be desirable as it is not a flexible solution. Reproducible: Always Steps to Reproduce: 1. Start Cantor and choose the Sage backend. 2. Type "import os; print __file__". 3. Save the worksheet. 4. Evaluate the current entry. Actual Results: An error is returned: NameError: name '__file__' is not defined Expected Results: It would be useful to obtain the path to the current worksheet. While this behaviour is completely normal, because the backend runs sage as an interactive server session which has no notion of "saved path", this limitation leads to hardcoding absolute paths into the current worksheet. A workaround would be to set the variable "__file__" when the worksheet is saved or loaded, so that it can be accessed with sage commands. -- You are receiving this mail because: You are watching all bug changes.