Skip to content

Commit 3952570

Browse files
Don JayamanneDon Jayamanne
authored andcommitted
updated with latest version
1 parent 08b06b5 commit 3952570

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

pythonFiles/PythonTools/visualstudio_py_util.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def exec_code(code, file, global_variables):
8787
except AttributeError:
8888
pass
8989

90-
sys.path[0] = os.path.split(file)[0]
90+
if os.path.isdir(sys.path[0]):
91+
sys.path.insert(0, os.path.split(file)[0])
92+
else:
93+
sys.path[0] = os.path.split(file)[0]
9194
code_obj = compile(code, file, 'exec')
9295
exec(code_obj, global_variables)
9396

@@ -131,7 +134,10 @@ def exec_module(module, global_variables):
131134
def read_bytes(conn, count):
132135
b = to_bytes('')
133136
while len(b) < count:
134-
b += conn.recv(count - len(b))
137+
received_data = conn.recv(count - len(b))
138+
if received_data is None:
139+
break
140+
b += received_data
135141
return b
136142

137143

@@ -622,4 +628,4 @@ def __repr__(self): return 'MyRepr'
622628

623629
if __name__ == '__main__':
624630
print('Running tests...')
625-
SafeRepr()._selftest()
631+
SafeRepr()._selftest()

0 commit comments

Comments
 (0)