0xC0000022L

Somewhere in the vicinity of Sol

127.0.0.1

Age: 42

1d
awarded Popular Question
Nov
20
reviewed Approve suggested edit on For-loop calling urllib.urlopen().getcode() is slow
Nov
20
revised Assigning many similar variables in a for loop
Tags are there to make it understood that this is about Python. No need to put a prefix into the title.
Nov
20
asked Is it okay to say "with self as foo:" in Python?
Nov
20
revised Sublime Text tabs appear garbled after closing a tab - how to "reset"?
added 468 characters in body
Nov
20
asked Sublime Text tabs appear garbled after closing a tab - how to "reset"?
Nov
18
comment How to manipulate the exception in __exit__ of a context manager?
I will have to try and create a minimal example that mimics the overall structure. Hope I can reproduce it this way. And yes, it looks like an AttributeError. Nothing in my code calls __exit__() explicitly, at least.
Nov
18
accepted How to manipulate the exception in __exit__ of a context manager?
Nov
18
comment How to manipulate the exception in __exit__ of a context manager?
the Python 2.6 on CentOS gives me the TypeError you described.
Nov
18
comment How to manipulate the exception in __exit__ of a context manager?
It is str. Is it possible that CentOS does something similar with Python as with the Linux kernel? I.e. mixing and matching as needed such that the version number doesn't really tell the truth? python -V reports Python 2.6.6.
Nov
18
comment How to manipulate the exception in __exit__ of a context manager?
Turns out 2.6 hands me a string exception. The string exception I am seeing is "'Download' object has no attribute 'purge'" and since I am not the one to convert an exception type to a string, I have to assume that this is passed to me by Python. Of course now I can go and fix the cause. But this was unexpected.
Nov
17
awarded Caucus
Nov
17
reviewed Reviewed How to cause program to stop execution when a particular value is found in memory
Nov
17
comment How to cause program to stop execution when a particular value is found in memory
The idea of reverse code engineering is usually not to "scan" a whole memory range for a specific value (on Windows Cheat Engine can do that for you; but don't do it for malicious samples!!!), but to selectively understand the code and work your way to the location of interest. This requires that you have an in-depth understanding of the representation certain library/runtime/OS features have in a program and being able to match those to the assembly code IDA or OllyDbg give you.
Nov
17
reviewed Close process terminated (5006) - ollydbg
Nov
17
reviewed Close What does OFT (INT) and FT (IAT) stand for?
Nov
14
awarded Good Question
Nov
14
awarded Favorite Question
Nov
13
comment How to manipulate the exception in __exit__ of a context manager?
I am only raising any exceptions based on BaseException myself. But library code I call may raise something else. This is on Python 2.6 - I have no option of using something newer on the machines on which this runs (CentOS with 2.6, no 2.7 in vanilla installation). I'll try to come up with a piece of code demonstrating it, yes. Gimme some time.
Nov
13
comment How to manipulate the exception in __exit__ of a context manager?
My assumption was that your v.extra_attribute = 'foobar' and my setattr(exc_value, 'extra_attribute', 'foobar') would be functionally equivalent. However, using it gives AttributeError: 'str' object has no attribute 'extra_attribute'. Why is the value I get to see a str instance instead of an exception instance? It's inside the __exit__() method.
1 2 3 4 5