pdb

Python variable is evaluated differently in pdb and print statements

心已入冬 提交于 2019-12-11 18:11:26
问题 I am using threads in a python program and recently found a problem where a float is not being interpreted correctly and whenever I go to print it out in pdb or in a logging statement, it shows up correctly most of the time. Oddly, it takes a different amounts of prints to show up in these two threads I just ran. Also the first two prints use the same format, but the value still changes in thread 1. for x in imports: if float(x.prob) == 0.0: logging.debug(float(x.prob)) logging.debug(float(x

keeping PDB file format after editing.

99封情书 提交于 2019-12-11 17:00:48
问题 I have xxx.pdb files as: ATOM 1910 CB SER 128 45.806 50.621 39.840 1.00 9.36 ATOM 1913 OG SER 128 44.538 51.195 39.571 1.00 9.36 ATOM 1915 C SER 128 45.325 48.172 40.360 1.00 9.36 ATOM 1916 O SER 128 45.368 47.955 39.155 1.00 9.36 ATOM 1917 N SER 129 44.953 47.236 41.238 1.00 11.24 ATOM 1919 CA SER 129 44.395 45.938 40.826 1.00 11.24 ATOM 1921 CB SER 129 44.091 45.053 42.031 1.00 11.24 ATOM 1924 OG SER 129 43.483 45.786 43.085 1.00 11.24 When I tried this code: awk '{if($10<11){$9="1.50"}

Start pdb on exception in Tornado's ioloop

烂漫一生 提交于 2019-12-11 13:22:23
问题 It's often useful to do this in standalone Python programs: def excepthook(typ, value, tb): traceback.print_exception(typ, value, tb) pdb.pm() ... if log.getEffectiveLevel() == logging.DEBUG: sys.excepthook = excepthook (i.e. if uncatched exception happens, program is dropped into pdb post-mortem mode) But that doesn't work with Tornado ioloop bc it seems that ioloop catches uncatched exceptions and prints or logs them. If I install above hook, the program enters post-mortem mode only on

How to get access to embedded assembly's metadata using IMetaDataDispenser.OpenScope?

强颜欢笑 提交于 2019-12-11 12:40:36
问题 I have a .NET solution which consists of several projects. It's possible to say that one of these projects is logically a primary one and all others are secondary. Our team has decided to build the project the next way. The main project will produce an assembly (I'll refer it to as Primary). All other projects' assemblies are Secondary and they will be embedded as a resource into the Primary one. The SourceCodeForExceptionHelper class in the Primary project is responsible for getting the

How do I enable pdbtrack python debugging in emacs 24.x shell?

[亡魂溺海] 提交于 2019-12-11 12:00:03
问题 With emacs 23.x, pdbtrack integration (giving you the arrow pointing to the current line of code) works with the regular M-x shell RET . This is useful, for example, to drop into the debugger while running automated tests with a Makefile. In emacs 24.x, this no longer works. I notice that if I run a python script with M-x python-shell-send-file then the pdbtrack integration works. But it does not work when running python via a standard emacs shell ( M-x shell RET ). 回答1: I use this snippet:

python debugger initialising with file

别来无恙 提交于 2019-12-11 07:33:59
问题 I am running a code with pdb python -m pdb somecode.py 3 I would like to pass a file on the command line, where I can specify the breakpoints. The code selects some dataset thought the passed parameter -- in this case 3 . I am running this script on a cluster. I know it is possible setting up .pdbrc , but I have some jobs running this code on different datasets (on those datasets the code works properly) and I don't want to interfere with that -- actually the other jobs are on the cluster

Rerun code while debugging and while reloading all modules

﹥>﹥吖頭↗ 提交于 2019-12-11 03:33:58
问题 When debugging my Python code, I run a script through ipdb from the command line, and set a number of breakpoints. Then I make some changes in one or more modules, and rerun. However, if I simply use run modules do not get reloaded. To make sure they do, I can exit and restart Python completely, but then I need to reset all breakpoints, which is tedious if I have many and if done over and over again. Is there a way to restart a run in (i)pdb, and make sure all modules get recursively reloaded

Cathing sys.exit() in debugger

吃可爱长大的小学妹 提交于 2019-12-11 03:03:30
问题 My programme ends unexpectedly. When I run it through pdb, it ends with: The program exited via sys.exit(). Exit status: but then there is no record of the stack at the instance it exited. I have no idea why it happens. Short of step and next ing through everything, is there a way to instruct pdb to enter the debugger when this is attempted, instead of honouring the sys.exit() ? 回答1: A simple-ish solution would be to monkey-patch sys.exit() before running: $ python -m pdb my_script.py (Pdb)

Attaching Python debugger

大兔子大兔子 提交于 2019-12-11 00:44:17
问题 I'd like to attach a Python debugger to a running process. Following this comment, I tried pdb-clone but have gotten confused. Here's the script I'm attaching to: import os import time from pdb_clone import pdbhandler pdbhandler.register() def loop(my_pid): print("Entering loop") while True: x = 'frog' time.sleep(0.5) print("Out of Loop") if __name__ == '__main__': my_pid = os.getpid() print("pid = ", my_pid) loop(my_pid) If I run python3 target_code_1.py in one terminal and see PID = 95439 ,

OpenCover cannot find PDB when using symbolic links?

会有一股神秘感。 提交于 2019-12-10 23:48:38
问题 In our output tree, the Test directory only contains symbolic links (Win7 x64) pointing to DLLs in various build directories. Next to each of these DLLs in the actual build directory is a corresponding PDB file. However, when running OpenCover on the DLL in the Test directory, it ends with "No results - no assemblies that matched the supplied filter were instrumented this could be due to missing PDBs for the assemblies that match the filter please review the output file and refer to the Usage