Skip to content

Commit 091017d

Browse files
committed
Refactor sys.path.append related code
1 parent 6c1a380 commit 091017d

3 files changed

Lines changed: 7 additions & 17 deletions

File tree

__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
#!/usr/bin/python
2-
# -*- coding: utf-8 -*-
3-
4-
import os
5-
import sys
6-
7-
sd = os.path.abspath(os.path.dirname(__file__))
8-
sys.path.append(sd)

core/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
#!/usr/bin/python
2-
# -*- coding: utf-8 -*-
3-
4-
import os
5-
import sys
6-
7-
sd = os.path.abspath(os.path.dirname(__file__))
8-
sys.path.append(sd)

sample.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33

4+
import sys
45
import os
5-
os.chdir(os.path.dirname(os.path.abspath(__file__)))
6+
import pathlib
7+
8+
9+
root_path = pathlib.Path(os.path.abspath(__file__)).parent
10+
sys.path.append(str(root_path))
11+
612

713
from core.drucker_worker_client import DruckerWorkerClient
814

0 commit comments

Comments
 (0)