简体   繁体   中英

Script works when run through normal python interpreter but fails when run through jupyter

I'm using VSCode messing around with jupyter (writing in python 3.9.7) I have two questions here:

First question, I have a script that I've written as a .py file and want to run it through jupyter so I can use its variable viewer (I hate the cluttered and messy way vscode's built-in variable viewer works), it works when I run it normally without jupyter, (using f5/ ctrl+f5, etc) but when I try to run it with jupyter, for some reason it appears to ignore the sys import and path editing to enable the call on another script.

在此处输入图片说明

Why would this be happening and how can I fix it?

Secondly, how do you enter debugging mode through jupyter? I've found that you can right click then hit "Run current file in interactive window" and its other run options to launch the script with jupyter, but there doesn't seem to be a way to enter line-by-line debugging. How do I get into debugging??

I think the differences of cwd caused it. Can you try to append the path with the absolute path?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM