What is the path to open a file with SuperTool?

What is the path (on Windows) to mention in the open() sentence to open a file with SuperTool?

I tried that syntax (and more /mnt/c…, nothing, …) and everytime I got an Error 2 No such file or directory error

with open("/c/Users/patri/insee_corrig_deces_INSEE_complete.csv", newline='') as insee_file:

with open("/mnt/c/Users/patri/insee_corrig_deces_INSEE_complete.csv", newline='') as insee_file:

with open("insee_corrig_deces_INSEE_complete.csv", newline='') as insee_file:

with open(pathlib.Path(r'C:\Users\patri', r'insee_deces_INSEE_complete.csv'), newline='') as insee_file:

...

If I try this:

import os

current_directory = os.getcwd()
print(current_directory)

I obtain: C:\Program Files\GrampsAIO64-5.2.2
and I don’t want to put my file there.

Does this example script for determining whether a media path is relative or absolute help?

The script does not display the path… but that’s easy to change.

My problem, at least I think, is not so much knowing my path (or Gramps path) but knowing what path (or path format) open() wants in SuperTool to open my file

But printing the value which is saved in the media path should help? It should be an example of the expected path format?

No, it doesn’t work too.

My path:

give me the same error if I use it as marked in the answer:

nor using a simple slash:

…and I’ve moved the file in G: :wink:

How about using the Gtk File Chooser in the Preferences to (temporarily) set the relative Media Path to the desired location? Take a reading and the set it back to the mapped “G:” drive.

adding the G: drive to my windows path?

Gtk is pretty fussy about Windows network drive locations. And very unsupportive of Windows enviromental variable features. (The Host/Port network feature apparently only supports linux.)

I am not confident that it will recognize the window path.

1 Like

Have you reviewed the documentation about Include files by @kku for SuperTool? It talks about a settings option to add a path to be recognized.

Yes, Ive also tried these paths without success

Hmmm. SuperTool has a feature to save and load scripts using a Gtk File Chooser. Maybe reviewing that core code would reveal some obscure knowledge

1 Like

Patrice, it seems to me that you last example should work:

with open(pathlib.Path(r'C:\\Users\\patri', r'insee_deces_INSEE_complete.csv'), newline='') as insee_file:

But is it missing the “corrig” part inthe file name? So maybe it should be

with open(pathlib.Path(r'C:\\Users\\patri', r'insee_corrig_deces_INSEE_complete.csv'), newline='') as insee_file:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.