Skip to content

Commit 18b94da

Browse files
committed
Bug Fixes
- Fixed path not being found because of trailing backslash returned from "where python". - Fixed path check at execution. - Improved timer, idk why I thought there were 100 miliseconds in a second.
1 parent b2a3857 commit 18b94da

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Install the addon.
4646

4747
If it did not find the path it'll say "PTVSD not Found", you'll have to set it manually. It's wherever python is + "\lib\site-packages". NO trailing backslash.
4848

49-
If you want, increase the timeout for the confirmation. It'll print "Waiting..." in the console ~ every second until it prints it's timedout. This does not mean the server has timedout *just* the confirmation listener.
49+
If you want, increase the timeout for the confirmation. It'll print "Waiting..." in the console every second until it prints it's timedout. This does not mean the server has timedout *just* the confirmation listener.
5050

5151
Open up Blender's search (default shortcut: space), type "Debug".
5252

__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bl_info = {
22
'name': 'Debugger for VS Code',
33
'author': 'Alan North',
4-
'version': (0, 0, 1),
4+
'version': (0, 0, 2),
55
'blender': (2, 79, 0),
66
"description": "Starts debugging server for VS Code.",
77
'location': 'In search (default shortcut:space) type "Debug"',
@@ -53,8 +53,8 @@ def check_for_ptvsd():
5353
if python_exe is not None:
5454
python_exe = str(python_exe.communicate()[0], "utf-8")
5555
match = re.search(".*(\\\\|/)", python_exe).group()
56-
if os.path.exists(match+"\lib\site-packages\ptvsd"):
57-
return match+"\lib\site-packages"
56+
if os.path.exists(match+"lib\site-packages\ptvsd"):
57+
return match+"lib\site-packages"
5858

5959
#check in our path
6060
for path in sys.path:
@@ -90,8 +90,8 @@ def draw(self, context):
9090

9191
# check if debugger has attached
9292
def check_done(i, modal_limit):
93-
if i % 100 == 0:
94-
print("Waiting")
93+
if i == 0 or i % 60 == 0:
94+
print("Waiting...")
9595
if i > modal_limit:
9696
print("Attach Confirmation Listener Timed Out")
9797
return {"CANCELLED"}
@@ -107,7 +107,7 @@ class DebuggerCheck(bpy.types.Operator):
107107

108108
_timer = None
109109
count = 0
110-
modal_limit = 20000
110+
modal_limit = 20*60
111111

112112
# call check_done
113113
def modal(self, context, event):
@@ -120,7 +120,7 @@ def execute(self, context):
120120
# set initial variables
121121
self.count = 0
122122
prefs = bpy.context.user_preferences.addons[__name__].preferences
123-
self.modal_limit = prefs.timeout*100
123+
self.modal_limit = prefs.timeout*60
124124

125125
wm = context.window_manager
126126
self._timer = wm.event_timer_add(0.1, context.window)
@@ -140,14 +140,14 @@ class DebugServerStart(bpy.types.Operator):
140140
def execute(self, context):
141141
#get ptvsd and import if exists
142142
prefs = bpy.context.user_preferences.addons[__name__].preferences
143-
ptvsd_path = os.path.abspath(prefs.path)
143+
ptvsd_path = prefs.path
144144

145145
#actually check ptvsd is still available
146146
if ptvsd_path == "PTVSD not Found":
147147
self.report({"ERROR"}, "Couldn't detect ptvsd, please specify the path manually in the addon preferences or reload the addon if you installed ptvsd after enabling it.")
148148
return {"CANCELLED"}
149-
150-
if not os.path.exists(ptvsd_path+"/ptvsd"):
149+
150+
if not os.path.exists(os.path.abspath(ptvsd_path+"/ptvsd")):
151151
self.report({"ERROR"}, "Can't find ptvsd at: %r/ptvsd." % ptvsd_path)
152152
return {"CANCELLED"}
153153

0 commit comments

Comments
 (0)