[issue40249] __import__ doesn't honour globals

2020-04-14 Thread Stefan Seefeld
Stefan Seefeld added the comment: I'm not entirely sure, but have to admit that the sentence "The function imports the module name, potentially using the given globals and locals to determine how to interpret the name in a package context." is a bit obscure. What does &quo

[issue40249] __import__ doesn't honour globals

2020-04-10 Thread Stefan Seefeld
Stefan Seefeld added the comment: OK, thanks for the clarification. I think this is obscure enough to warrant at least a paragraph or two to clarify the semantics of these arguments. I changed the issue "components" and "type" to reflect that. -- assignee: ->

[issue40249] __import__ doesn't honour globals

2020-04-10 Thread Stefan Seefeld
New submission from Stefan Seefeld : I'm trying to import custom scripts that expect the presence of certain variables in the global namespace. It seems `__import__('script', globals=dict(foo='bar'))` doesn't have the expected effect of injecting "foo" into the namespace

[issue35830] building multiple (binary) packages from a single project

2019-03-08 Thread Stefan Seefeld
Change by Stefan Seefeld : -- resolution: -> works for me stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue35830] building multiple (binary) packages from a single project

2019-01-25 Thread Stefan Seefeld
Stefan Seefeld added the comment: Yes. Depending on the answer to my question(s), the request either becomes: "please add support for this use-case", or "this use-case isn't documented properly", i.e. a feature request or a bu

[issue35830] building multiple (binary) packages from a single project

2019-01-25 Thread Stefan Seefeld
New submission from Stefan Seefeld : I'm working on a project that I'd like to split into multiple separately installable components. The main component is a command-line tool without any external dependencies. Another component is a GUI frontend that adds some third-party dependencies

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-07 Thread Stefan Seefeld
Stefan Seefeld added the comment: > The limitation is a consequence of how Linux works. > Unix has no cross-platform API for non-blocking waiting for child process > finish except handling SIGCHILD signal. Why does the `wait()` have to be non-blocking ? We can call it once in

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-07 Thread Stefan Seefeld
Stefan Seefeld added the comment: OK, so while I have been able to work around the issues (by using `quamash` to bridge between `asyncio` and `Qt`), I'd still like to understand the rationale behind the limitation that any subprocess-managing event-loop has to run in the main thread

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-04 Thread Stefan Seefeld
Stefan Seefeld added the comment: That's quite an unfortunate limitation ! I'm working on a GUI frontend to a Python tool I wrote using asyncio, and the GUI (Qt-based) itself insists to run its own event loop in the main thread. I'm not sure how to work around this limitation, but I can

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-01 Thread Stefan Seefeld
New submission from Stefan Seefeld : This is an addendum to issue35621: To be able to call `asyncio.create_subprocess_exec()` from another thread, A separate event loop needs to be created. To make the child watcher aware of this new loop, I have to call `asyncio.get_child_watcher

[issue35621] asyncio.create_subprocess_exec() only works with main event loop

2019-01-01 Thread Stefan Seefeld
Change by Stefan Seefeld : -- nosy: +stefan ___ Python tracker <https://bugs.python.org/issue35621> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35449] documenting objects

2018-12-10 Thread Stefan Seefeld
Stefan Seefeld added the comment: ad 3) sorry, I picked a bad example - I didn't mean to suggest that immutable objects should in fact become mutable by modifying their `__doc__` attribute. ad 1) good, glad to hear that. ad 2) fine. In fact, I'm not even proposing that per-instance

[issue35449] documenting objects

2018-12-09 Thread Stefan Seefeld
Stefan Seefeld added the comment: On 2018-12-09 19:48, Karthikeyan Singaravelan wrote: > There was a related proposal in > https://www.python.org/dev/peps/pep-0258/#attribute-docstrings Right, but that was rejected (for unrelated reasons). The idea itself was rejected by Guido

[issue35449] documenting objects

2018-12-09 Thread Stefan Seefeld
Stefan Seefeld added the comment: On 2018-12-09 18:35, Steven D'Aprano wrote: > Steven D'Aprano added the comment: > >> Is there any discussion concerning what syntax might be used for >> docstrings associated with objects ? > I don't know about PyDoc in general, but I

[issue35449] documenting objects

2018-12-09 Thread Stefan Seefeld
Stefan Seefeld added the comment: Exactly ! I'm fully aware of the ubiquity of objects in Python, and it is for that reason that I had naively expected `pydoc` to simply DoTheRightThing when encountering an object containing a `__doc__` attribute. rather than only working for types

[issue35449] documenting objects

2018-12-09 Thread Stefan Seefeld
New submission from Stefan Seefeld : On multiple occasions I have wanted to add documentation not only to Python classes and functions, but also instance variables. This seems to involve (at least) two orthogonal questions: 1) what is the proper syntax to associate documentation (docstrings

[issue33389] argparse redundant help string

2018-04-29 Thread Stefan Seefeld
New submission from Stefan Seefeld <ste...@seefeld.name>: I'm using Python's `argparse` module to define optional arguments. I'm calling the `argparse.add_argument` method to add both short and long arguments, but I notice that the generated help message lists some information

[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld
Stefan Seefeld <ste...@seefeld.name> added the comment: It looks like https://bugs.python.org/issue14191 is a conversation about the same inconsistent behaviour. It is set to "fixed". Can you comment on this ? Should I follow the advice mentioned there about how to work

[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld
Stefan Seefeld <ste...@seefeld.name> added the comment: On 15.11.2017 12:54, R. David Murray wrote: > Can you reproduce this without your PosArgsParser? I can indeed (by simply commenting out the `action` argument to the `add_argument()` calls). That obviously results in all positional

[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld
New submission from Stefan Seefeld <ste...@seefeld.name>: I'm trying to mix positional and non-positional arguments with a script using `argparse`, but I observe inconsistent behaviour. The attached test runs fine when invoked with test_argparse.py --info a a=b test_argparse.py a a=b

[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld
Stefan Seefeld added the comment: OK, fair enough, that makes sense. As I said, in my last message, I was mainly simply trying to figure out the exact location of the error in the executed script, which I got from inspecting the SyntaxError. So if all of this is expected behaviour, I think we

[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld
Stefan Seefeld added the comment: Answering my own question: It appears I can get the location of a syntax error by inspecting the raised `SyntaxError`, which solves my specific use-case. The bug remains, though: The traceback is incomplete if it stems from a syntax error

[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld
Stefan Seefeld added the comment: Some further experiements: Replacing the `exec(f.read(), env)` line by ``` code = compile(f.read(), 'script', 'exec') exec(code, env) ``` exhibits the same behaviour. If I remove the `try...except`, the correct (full) traceback is printed out. So it looks like

[issue30496] Incomplete traceback with `exec`

2017-05-28 Thread Stefan Seefeld
New submission from Stefan Seefeld: The following code is supposed to catch and report errors encountered during the execution of a (python) script: ``` import traceback import sys try: env = {} with open('script') as f: exec(f.read(), env) except: type_, value_, tb

[issue26481] unittest discovery process not working without .py source files

2016-03-04 Thread Stefan Seefeld
New submission from Stefan Seefeld: The unittest test discovery right now only looks into sub-packages if they contain a `__init__.py` file. That's an unnecessary requirement, as packages are also importable if only `__init__.pyc` is present. -- components: Library (Lib) messages

[issue25520] unittest load_tests protocol not working as documented

2016-01-21 Thread Stefan Seefeld
Stefan Seefeld added the comment: I believe what I actually want is for the discovery mechanism to be fully implicit. It turns out that already *almost* works right now. What doesn't work (and what this bug report really was about initially), is the use of the 'discover' command with the '-p

[issue25520] unittest load_tests protocol not working as documented

2016-01-20 Thread Stefan Seefeld
Stefan Seefeld added the comment: Hi, I'm investigating more issues related to test loading, and thus I have discovered issue #16662. I have found quite a number of inconsistencies and bugs in the loading of tests. But without getting a sense of what the supposed behavior is I find

[issue26033] distutils default compiler API is incomplete

2016-01-06 Thread Stefan Seefeld
New submission from Stefan Seefeld: I'm trying to use the distutil compiler to preprocess some header (to be used with the cffi package). The code is compiler = distutils.ccompiler.new_compiler() compiler.add_include_dir(join(sys.prefix, 'include')) compiler.preprocess(source

[issue25726] sys.setprofile / sys.getprofile asymetry

2015-11-24 Thread Stefan Seefeld
New submission from Stefan Seefeld: I'm using the `cProfile` module to profile my code. I tried to temporarily disable the profiler by using: prof = sys.getprofile() sys.setprofile(None) ... sys.setprofile(prof) resulting in an error. The reason is that with `cProfile

[issue25520] unittest load_tests protocol not working as documented

2015-10-30 Thread Stefan Seefeld
New submission from Stefan Seefeld: As described in the README contained in the attached tarball, I'm observing wrong behavior. I have based this code on my understanding of https://docs.python.org/2/library/unittest.html#load-tests-protocol, but the effect isn't as expected (I see duplicate

[issue2101] xml.dom documentation doesn't match implementation

2008-02-13 Thread Stefan Seefeld
New submission from Stefan Seefeld: The docs at http://docs.python.org/lib/dom-element-objects.html claim that removeAttribute(name) silently ignores the attempt to remove an unknown attribute. However, the current implementation in the minidom module (part of _xmlplus) raises

[issue2041] __getslice__ still called

2008-02-07 Thread Stefan Seefeld
Stefan Seefeld added the comment: Mark, thanks for the quick follow-up. OK, i now understand the situation better. The documentation I had read originally didn't talk about special-casing built-in objects. (And since I want to extend a tuple, I do have to override __getslice__ since I want

[issue2041] __getslice__ still called

2008-02-07 Thread Stefan Seefeld
New submission from Stefan Seefeld: The python documentation states that since python 2.0 __getslice__ is obsoleted by __getitem__. However, testing with python 2.3 as well as 2.5, I find the following surprising behavior: class Tuple(tuple): def __getitem__(self, i): print '__getitem__', i

Announcement: Synopsis 0.8

2005-06-09 Thread Stefan Seefeld
I'm pleased to announce the release of Synopsis 0.8. Synopsis is a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation.

None module reference

2005-05-21 Thread Stefan Seefeld
hello, I'v run into a bug that I find hard to understand: In a python module of mine I import system modules ('sys', say) and then use them from within some functions. However, during program termination I'm calling one such function and the module reference ('sys') is 'None' ! What does that

Re: domain specific UI languages

2005-04-13 Thread Stefan Seefeld
max(01)* wrote: hi. in a previous thread, mr lundh talks about the possibility to create domain specific UI languages using tkinter. can he (or anyone else who pleases) explain what they are? give some examples (simple is better)? Without having read the original thread, I imagine such a beast

Re: Missing Module when calling 'Import' _omnipy

2005-04-12 Thread Stefan Seefeld
[EMAIL PROTECTED] wrote: I found the fike _omnipy.pyd is that what you mean? yep. Here is my Lib Path: [...] As a first step you may consider adding the directory containing '_omnipy.pyd' to your PYTHONPATH variable. Second, you may read any documentation you can find at

Re: Problem with import from omniORB import CORBA, PortableServer

2005-04-11 Thread Stefan Seefeld
[EMAIL PROTECTED] wrote: Thank for the reply, I think your right my problem is the what version to us, I want to write some Python scripts calling Corba Objects what do i need ? omnipython-1.5.2-1 this looks like *really* old (and obsolete) stuff... omniORBpy 2.5 omniORB 4.0.5 Python 2.4.1 These

Re: Missing Module when calling 'Import' _omnipy

2005-04-11 Thread Stefan Seefeld
[EMAIL PROTECTED] wrote: I am trying to run an Corba example using Python and i get the follwing error: import _omnipy ImportError: No module named _omnipy Where can i find this Module ? This is an extension module (i.e. the file is named _omnipy.so or _omnipy.dll, I believe), and it is in

Re: Stylistic question about inheritance

2005-03-31 Thread Stefan Seefeld
Andrew Koenig wrote: Of course, there are reasons to have a base class anyway. For example, I might want it so that type queries such as isinstance(foo, Expr) work. My question is: Are there other reasons to create a base class when I don't really need it right now? Coming from C++ myself, I

Re: Which is easier? Translating from C++ or from Java...

2005-03-28 Thread Stefan Seefeld
[EMAIL PROTECTED] wrote: Patrick Useldinger wrote: cjl wrote: Implementations of what I'm trying to accomplish are available (open source) in C++ and in Java. Which would be easier for me to use as a reference? I'm not looking for automated tools, just trying to gather opinions on which language

Re: exec src in {}, {} strangeness

2005-03-21 Thread Stefan Seefeld
Do Re Mi chel La Si Do wrote: Hi ! Try : exec f in globals(),locals() or exec(f,globals(),locals()) or exec f in globals(),globals() or exec(f,globals(),globals()) Indeed, using 'globals()' and 'locals()' works. However, both report the same underlaying object, which is a bit

Re: exec src in {}, {} strangeness

2005-03-21 Thread Stefan Seefeld
Peter Hansen wrote: Stefan Seefeld wrote: Indeed, using 'globals()' and 'locals()' works. However, both report the same underlaying object, which is a bit confusing. (Under what circumstances does 'locals()' return not the same object as 'globals()' ?) When you aren't at the interactive prompt

Re: exec src in {}, {} strangeness

2005-03-21 Thread Stefan Seefeld
Bernhard Herzog wrote: Stefan Seefeld [EMAIL PROTECTED] writes: Is there anything wrong with 'exec source in a, b' where a and b are distinc originally empty dictionaries ? Again, my test code was class Foo: pass class Bar: foo = Foo and it appears as if 'Foo' was added to 'a', but when

exec src in {}, {} strangeness

2005-03-20 Thread Stefan Seefeld
hi there, I have trouble running some python code with 'exec': t.py contains: class Foo: pass class Bar: f = Foo From a python shell I do: f = ''.join(open('t.py').readlines()) exec f in {}, {} Traceback (most recent call last): File stdin, line 1, in ? File string, line 2, in ? File

Re: lies about OOP

2004-12-13 Thread Stefan Seefeld
Craig Ringer wrote: On Tue, 2004-12-14 at 16:02, Mike Thompson wrote: I would pick the publication of Design Patterns in 1995 by the Gang of Four (Gamma, Helm, Johnson, and Vlissides), to be the herald of when the Joy of OOP would be widely known. DP formalized a taxonomy for many of the