Skip to content

Commit 71b0c82

Browse files
committed
Merge pull request #41 from aburgm/connection-dir
Avoid creating default connection dir if not needed
2 parents 9b404d3 + d92e430 commit 71b0c82

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ipykernel/kernelapp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ class IPKernelApp(BaseIPythonApplication, InteractiveShellApp,
115115
# connection info:
116116
connection_dir = Unicode()
117117
def _connection_dir_default(self):
118-
d = jupyter_runtime_dir()
119-
ensure_dir_exists(d, 0o700)
120-
return d
118+
return jupyter_runtime_dir()
121119

122120
@property
123121
def abs_connection_file(self):
@@ -201,7 +199,9 @@ def init_connection_file(self):
201199
self.connection_file = filefind(self.connection_file, ['.', self.connection_dir])
202200
except IOError:
203201
self.log.debug("Connection file not found: %s", self.connection_file)
204-
# This means I own it, so I will clean it up:
202+
# This means I own it, and I'll create it in this directory:
203+
ensure_dir_exists(os.path.dirname(self.abs_connection_file), 0o700)
204+
# Also, I will clean it up:
205205
atexit.register(self.cleanup_connection_file)
206206
return
207207
try:

0 commit comments

Comments
 (0)