When I try to import draw_graph on my Mac, I get the following error.
|
"from utils import draw_graph" |
`---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
FileNotFoundError: [Errno 2] No such file or directory: '/data/Chapter01/figures'
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
FileNotFoundError: [Errno 2] No such file or directory: '/data/Chapter01'
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
Cell In[1], line 12
8 import sys
10 sys.path.append(f"{os.getcwd()}/..")
---> 12 from utils import draw_graph
File ~/Documents/Graph-Machine-Learning/Chapter01/../utils.py:19
16 enhanced_edge_color = '#cc2f04'
18 if not FIGURES_DIR.exists():
---> 19 FIGURES_DIR.mkdir(parents=True)
21 # draw a simple graph
22 def draw_graph(G, node_names={}, filename=None, node_size=50, layout = None, plot_weight=False):
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1327, in Path.mkdir(self, mode, parents, exist_ok)
1325 if not parents or self.parent == self:
1326 raise
-> 1327 self.parent.mkdir(parents=True, exist_ok=True)
1328 self.mkdir(mode, parents=False, exist_ok=exist_ok)
1329 except OSError:
1330 # Cannot rely on checking for EEXIST, since the operating system
1331 # could give priority to other errors like EACCES or EROFS
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1327, in Path.mkdir(self, mode, parents, exist_ok)
1325 if not parents or self.parent == self:
1326 raise
-> 1327 self.parent.mkdir(parents=True, exist_ok=True)
1328 self.mkdir(mode, parents=False, exist_ok=exist_ok)
1329 except OSError:
1330 # Cannot rely on checking for EEXIST, since the operating system
1331 # could give priority to other errors like EACCES or EROFS
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1319 """
1320 Create a new directory at this given path.
1321 """
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
1325 if not parents or self.parent == self:
OSError: [Errno 30] Read-only file system: '/data'`
It is because this line is trying to create the directory in my root.
|
DATA_DIR = pathlib.Path("/") / "data" / _chapter |
When I try to import draw_graph on my Mac, I get the following error.
Graph-Machine-Learning/Chapter01/01_Introduction_Networkx.ipynb
Line 27 in 513387b
`---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
FileNotFoundError: [Errno 2] No such file or directory: '/data/Chapter01/figures'
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
FileNotFoundError: [Errno 2] No such file or directory: '/data/Chapter01'
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
Cell In[1], line 12
8 import sys
10 sys.path.append(f"{os.getcwd()}/..")
---> 12 from utils import draw_graph
File ~/Documents/Graph-Machine-Learning/Chapter01/../utils.py:19
16 enhanced_edge_color = '#cc2f04'
18 if not FIGURES_DIR.exists():
---> 19 FIGURES_DIR.mkdir(parents=True)
21 # draw a simple graph
22 def draw_graph(G, node_names={}, filename=None, node_size=50, layout = None, plot_weight=False):
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1327, in Path.mkdir(self, mode, parents, exist_ok)
1325 if not parents or self.parent == self:
1326 raise
-> 1327 self.parent.mkdir(parents=True, exist_ok=True)
1328 self.mkdir(mode, parents=False, exist_ok=exist_ok)
1329 except OSError:
1330 # Cannot rely on checking for EEXIST, since the operating system
1331 # could give priority to other errors like EACCES or EROFS
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1327, in Path.mkdir(self, mode, parents, exist_ok)
1325 if not parents or self.parent == self:
1326 raise
-> 1327 self.parent.mkdir(parents=True, exist_ok=True)
1328 self.mkdir(mode, parents=False, exist_ok=exist_ok)
1329 except OSError:
1330 # Cannot rely on checking for EEXIST, since the operating system
1331 # could give priority to other errors like EACCES or EROFS
File /usr/local/Cellar/python@3.9/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py:1323, in Path.mkdir(self, mode, parents, exist_ok)
1319 """
1320 Create a new directory at this given path.
1321 """
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
1325 if not parents or self.parent == self:
OSError: [Errno 30] Read-only file system: '/data'`
It is because this line is trying to create the directory in my root.
Graph-Machine-Learning/utils.py
Line 9 in 513387b