How should a gramplet validate a (local, network, internet) file path string?

Has the Gramps-Project approved a standard process for path validation, evaluation and verification?

Does it identify whether a string was intended to be a URL, URI or internal relative reference? Then does it evaluate Gramps or OS specific Environment Variables? Then does it validate that the string is a legal form? Then does it verify that the resource is accessible with the current system without attempting to open the resource?

pathvalidate

Summary
    Features
Examples
    Sanitize a filename
    Sanitize a filepath
    Validate a filename
    Check a filename
    filename/filepath validator for argparse
    filename/filepath sanitizer for argparse
    filename/filepath validator for click
    filename/filepath sanitizer for click
    For more information
Installation
    Installation: pip
    Installation: conda
    Installation: apt
Dependencies
Documentation
Sponsors

Use os.path.expandvars to expand the environment variables in the string, for example:

os.path.expandvars(’$C/test/testing’)
‘/stackoverflow/test/testing’

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