Registry / serialization / Unipath

Unipath

JSON →
library1.1pypypi✓ verified 84d ago

Unipath provides an object-oriented alternative to os/os.path/shutil for Python file system path manipulation, wrapping common operations in a Path class. Current version is 1.1, stable but in maintenance mode with infrequent releases.

pip install Unipath
INSTALL
IMPORT
SIG · UNIPATH
U
Unipath
serializationpythonv1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Path
from unipath import Path
from unipath.path import Path
Direct import from unipath is the correct pattern.
FSPath
from unipath import FSPath

Basic usage: create a Path and check existence/read content.

from unipath import Path # Create a Path object p = Path('/tmp/example.txt') # Check existence print(p.exists()) # True if file exists # Read content if p.exists(): print(p.read_file())
Debug
Known issues
breakingUnipath does not work with Python 3.12+ if using any import of 'os.path' functions that have been removed (e.g., os.path.walk). The library itself is compatible with Python up to 3.11. For Python 3.12+, consider using pathlib which is available in the standard library.
fix
Migrate to pathlib.Path for Python 3.12+ compatibility. Unipath may not receive updates.
affects: >=1.1, Python >=3.12
deprecatedUnipath is no longer actively developed. The author recommends using pathlib from the standard library for new projects.
fix
Use pathlib.Path instead: from pathlib import Path.
affects: all
gotchaUnipath's Path inherits from str, so string concatenation with '+' may not work as expected. Use .child() method for joining paths.
fix
Use p.child('subdir') instead of p + '/subdir'.
affects: all
gotchaThe .exists() method caches results; if the file system changes, use .exists(refresh=True) to get current status.
fix
Call p.exists(refresh=True) to bypass cache.
affects: all
Errors
Common errors & fixes
AttributeError: module 'unipath' has no attribute 'Path'
Incorrect import: 'from unipath import Path' is correct; 'import unipath' does not expose Path directly.
fix
Use: from unipath import Path
TypeError: expected str, bytes or os.PathLike object, not Path
Unipath Path is a subclass of str, but some functions in Python standard library may not accept it directly. Convert to str explicitly.
fix
Use str(p) when passing to functions that expect str or os.PathLike.
DeprecationWarning: unipath.Path is deprecated, use pathlib instead
Unipath is deprecated; this warning may be issued in some environments.
fix
Migrate to pathlib.Path: from pathlib import Path.
Upgrade
Version history
1.1latest on PyPI · released Feb 11, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
61 hits · last 30 days
node
54
OpenAI (training)
1
Resources
Unipath — pip install Unipath · libregistry