Skip to content

Commit 0557671

Browse files
committed
return default ipc path whether it exists or not
1 parent 2db68ac commit 0557671

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

web3/providers/ipc.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,15 @@ def get_default_ipc_path() -> Optional[str]:
9191
ipc_path = os.path.expanduser(
9292
os.path.join("~", "Library", "Ethereum", "geth.ipc")
9393
)
94-
if os.path.exists(ipc_path):
95-
return ipc_path
96-
return None
94+
return ipc_path
9795

9896
elif sys.platform.startswith("linux") or sys.platform.startswith("freebsd"):
9997
ipc_path = os.path.expanduser(os.path.join("~", ".ethereum", "geth.ipc"))
100-
if os.path.exists(ipc_path):
101-
return ipc_path
102-
return None
98+
return ipc_path
10399

104100
elif sys.platform == "win32":
105101
ipc_path = r"\\.\pipe\geth.ipc"
106-
if os.path.exists(ipc_path):
107-
return ipc_path
108-
return None
102+
return ipc_path
109103

110104
else:
111105
raise ValueError(
@@ -117,27 +111,20 @@ def get_default_ipc_path() -> Optional[str]:
117111
def get_dev_ipc_path() -> Optional[str]:
118112
if os.environ.get("WEB3_PROVIDER_URI", ""):
119113
ipc_path = os.environ.get("WEB3_PROVIDER_URI")
120-
if os.path.exists(ipc_path):
121-
return ipc_path
122-
return None
114+
return ipc_path
123115

124116
elif sys.platform == "darwin":
125117
tmpdir = os.environ.get("TMPDIR", "")
126118
ipc_path = os.path.expanduser(os.path.join(tmpdir, "geth.ipc"))
127-
if os.path.exists(ipc_path):
128-
return ipc_path
129-
return None
119+
return ipc_path
130120

131121
elif sys.platform.startswith("linux") or sys.platform.startswith("freebsd"):
132122
ipc_path = os.path.expanduser(os.path.join("/tmp", "geth.ipc"))
133-
if os.path.exists(ipc_path):
134-
return ipc_path
135-
return None
123+
return ipc_path
136124

137125
elif sys.platform == "win32":
138126
ipc_path = os.path.join("\\\\", ".", "pipe", "geth.ipc")
139-
if os.path.exists(ipc_path):
140-
return ipc_path
127+
return ipc_path
141128

142129
else:
143130
raise ValueError(

0 commit comments

Comments
 (0)