runoff/ $ debug50 ./runoff a b c
Launching VS Code debugger...
Traceback (most recent call last):
File "/usr/local/bin/debug50", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/site-packages/debug50/__main__.py", line 72, in main
asyncio.get_event_loop().run_until_complete(launch(args.PROGRAM, extra_args))
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/debug50/__main__.py", line 90, in launch
source = list(filter(lambda source_file: program in source_file, get_source_files(program)))[0]
IndexError: list index out of range
After I updated the web IDE for CS50, I keep getting this error whenever I try to launch debug50. I don't know what to do. It was working just fine.
Obs: I'm setting the breakpoints, I didn't miss this part.
I ran into this same issue. I'm wondering if an update to debug50 has been made. Here's how I got it to work.
Try omitting the ./ from your command line script, so long as you are in the directory containing your program.
e.g.
debug50 runoff a b c
Related
Tried with multiple different python files. Every time I try to use the debugger in vs code and set breakpoints the breakpoint gets ignored and exception gets raised and the script continues on. I've been googling and tinkering for over 2 hours and can't seem to figure out what's going on here. Tried rebooting PC, running vs code as admin, uninstall/reinstall the python extension for vs code. Tried to dig into the files mentioned in the traceback and pinpointed the function that seems to be raising the exception but I can't figure out where it's being called from or why it's raising the exception. I'm still new-ish to Python. Debugging works properly on my laptop but for whatever reason my desktop is having this issue.
Traceback (most recent call last):
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 529, in _original_file_to_client
return cache[filename]
KeyError: 'c:\\users\\joel\\local settings\\application data\\programs\\python\\python37-32\\lib\\runpy.py'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 330, in _on_run
self.process_net_command_json(self.py_db, json_contents)
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 190, in process_net_command_json
cmd = on_request(py_db, request)
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 771, in on_stacktrace_request
self.api.request_stack(py_db, request.seq, thread_id, fmt=fmt, start_frame=start_frame, levels=levels)
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_api.py", line 214, in request_stack
if internal_get_thread_stack.can_be_executed_by(get_current_thread_id(threading.current_thread())):
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 661, in can_be_executed_by
py_db, self.seq, self.thread_id, frame, self._fmt, must_be_suspended=not timed_out, start_frame=self._start_frame, levels=self._levels)
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_net_command_factory_json.py", line 213, in make_get_thread_stack_message
py_db, frames_list
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_net_command_factory_xml.py", line 175, in _iter_visible_frames_info
new_filename_in_utf8, applied_mapping = pydevd_file_utils.norm_file_to_client(filename_in_utf8)
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 531, in _original_file_to_client
translated = _path_to_expected_str(get_path_with_real_case(_AbsFile(filename)))
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 221, in _get_path_with_real_case
return _resolve_listing(drive, iter(parts))
File "c:\Users\Joel\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 184, in _resolve_listing
dir_contents = cache[resolved_lower] = os.listdir(resolved)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\Joel\\Local Settings'
So I get this traceback every time a breakpoint is hit. Taking a peek at the "_original_file_to_client" function in "pydevd_file_utils.py" we get this:
def _original_file_to_client(filename, cache={}):
try:
return cache[filename]
except KeyError:
translated = _path_to_expected_str(get_path_with_real_case(_AbsFile(filename)))
cache[filename] = (translated, False)
return cache[filename]
I wasn't able to figure out where this function was being called from or what the expected output was supposed to be. Any help with this would be greatly appreciated!
Edit: Forgot to mention I'm using Windows 10 if it wasn't obvious from the trace
This is a similar question. The spaces in the filename cause this problem:
"Local Settings", "application data"
When I run this on Pycharm 4 on windows I got an error in this code:
PDBSumWWW = urllib.urlopen("https://www.ebi.ac.uk/thornton-srv/databases/pdbsum/data/seqdata.dat")
PDBSum = PDBSumWWW.read().splitlines()
PDBSumWWW.close()
This is the error message:
Traceback (most recent call last):
File "C:/Users/LuisAlberto/PycharmProjects/MSc/SeqPDBSumIRIndex.py", line 98, in
main()
File "C:/Users/LuisAlberto/PycharmProjects/MSc/SeqPDBSumIRIndex.py", line 40, in main
PDBSum = PDBSumWWW.read().splitlines()
MemoryError
However when running in on a Macbook Air it doesnt happen.
how do I get over this?
This is the most simple solution that I can think of to solve your problem.
In this solution the for loop will iterate over every line in the database.every line will be assigned to the line variable.
PDBSumWWW = urllib.urlopen("https://www.ebi.ac.uk/thornton-srv/databases/pdbsum/data/seqdata.dat")
for line in PDBSumWWW:
# Do necessary calculations.
PDBSumWWW.close()
I am new to jira-python and have run into an issue with using jirashell.
jira-python was installed from documentation given here: http://jira.readthedocs.org/en/latest/
When I try to start jirashell using:
ubuntu#ip-10-0-0-12:~$ jirashell -s https://jira.atlassian.com
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/jirashell", line 11, in <module> sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jira/jirashell.py", line 248, in main
jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 202, in __init__self._create_oauth_session(oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 1871, in _create_oauth_session
oauth['consumer_key'],
KeyError: u'consumer_key'
I have also tried to get to a server using basic auth but that returns the same error. Using curl works fine, but I wanted to see the objects that are getting returned and get help as I develop by python-jira integration.
Thank you for any insight.
Currently my Python + Tweep bot isn't working claiming the status is a duplicate. The exact error is
Traceback (most recent call last):
File "helloworld.py", line 22, in <module>
api.update_status(line)
File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 230, in _call
return method.execute()
File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 203, in execute
raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Status is a duplicate.', u'code': 187}]
The bot source is here: https://ghostbin.com/paste/vbdn4 .
What can I add to work around this error?
Note that the first time running this there were no errors yet after stopping it and then going to run it again, I got this error.
you forget to step to the next line of the .txt file you're feeding in the for-loop (it does have multiple lines, doesn't it?), I guess....
I've got the same problem ;-) Tried to solve it with 3 different .txt files and give 3 args in a whlie loop, but this doesn't fly either.
We'll get there....
My Python script reports where it goes wrong ("line 122" in myscript.py), when I run it in a shell:
$ toc2others.py -i toc -p pg
Traceback (most recent call last):
File "~/myscript.py", line 122, in <module>
p = re.match(keywords[index+1][0], inlines[n+1], re.IGNORECASE)
IndexError: list index out of range
It is because keywords[index+1] goes out of the index range of keywords.
When I run it under pdb, however, it doesn't report where it goes wrong, but says something unrelated (error is reported to take place at import re).
$ pdb ~/myscript.py -i toc -p pg
> /myscript.py(3)<module>()
-> import re
(Pdb) c
Traceback (most recent call last):
File "/usr/lib/python2.7/pdb.py", line 1314, in main
pdb._runscript(mainpyfile)
File "/usr/lib/python2.7/pdb.py", line 1233, in _runscript
self.run(statement)
File "/usr/lib/python2.7/bdb.py", line 387, in run
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "~/myscript.py", line 3, in <module>
import re
IndexError: list index out of range
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
I wonder why pdb states something unrelated and misleading?
Can pdb state where it actually goes wrong?
Thanks.
It's a bug, actually.
See issues:
http://bugs.python.org/issue16482
http://bugs.python.org/issue17277
This only happens if exception is thrown on module-level of executed file, i.e. not inside any function. So if you just put your code in a main() function, this will fix it. Or you can use ipython, which is much more fun for debugging:
ipython ~/myscript.py --pdb -- -i toc -p pg
This will run the script and only stop if there's an error, and it also does not suffer from the above bug.