Easy path for python import/save/load process
Project description
epath
This package provides easy and dynamic way to import parent files in Python.
Sample folder structure can be seen below.
--main_folder
--app.py
--folder_1
--sample.txt
--folder_2
--target.py
Here, it is desired to read the sample.txt file from the target.py file. Then it will be used by calling the say_hello and say_goodBye functions in the app.py file.
app.py
def say_hello():
print("Hello")
def say_goodBye():
print("GoodBye")
sample.txt
This is a sample.txt
target.py
from epath import Path
pt = Path()
txt_path = pt.get("/../folder_1/sample.txt")
with open(txt_path) as f:
lines = f.readlines()
print(lines)
>>>['This is a sample.txt ']
#----------------------------------
app = pt.importer("/../app")
app.say_hello()
>>>Hello
app.say_goodBye()
>>>GoodBye
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
epath-0.7.tar.gz
(3.3 kB
view details)
Built Distribution
epath-0.7-py3-none-any.whl
(3.3 kB
view details)
File details
Details for the file epath-0.7.tar.gz
.
File metadata
- Download URL: epath-0.7.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e420cf6c4b4c2e3a86f33a2e78968124e359613e8fae2bd5391644381886c78 |
|
MD5 | dbd289319c2fbe4feafa3466329368cb |
|
BLAKE2b-256 | 5ae7a8ce60706f5b1ac3f697252b4356a7610e19045909f54500b1751e575e40 |
File details
Details for the file epath-0.7-py3-none-any.whl
.
File metadata
- Download URL: epath-0.7-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb346c1efe30c45916394ae6140cc40a7bbe1d5f50a6b909d6ee27712a671d27 |
|
MD5 | 8f78233b2686de9e194e39d0f72e9807 |
|
BLAKE2b-256 | ae5925ae9e12f586cad9865ab8f62f2abfcfde15bf0a54cc0243c3b4467a471e |