Hello,
I am trying to redirect the IO (stdout, stdin and stderr) to the console.
Is there a Python module for this?
Thanks.
Regards
--
https://mail.python.org/mailman/listinfo/python-list
sys.stderr = fp
setvbuf( stderr, NULL, _IONBF, 0 )
# make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog
# point to console as well
Is there a better way to handling IO redirection to console in Python?
Thanks.
Austin
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, January 4, 2015 12:20:26 PM UTC+1, austin aigbe wrote:
> On Sunday, January 4, 2015 8:12:10 AM UTC+1, Terry Reedy wrote:
> > On 1/3/2015 6:19 PM, austin aigbe wrote:
> >
> > > I am currently implementing the LTE physical layer in Python (ver 2.7.7).
> > &
On Sunday, January 4, 2015 8:12:10 AM UTC+1, Terry Reedy wrote:
> On 1/3/2015 6:19 PM, austin aigbe wrote:
>
> > I am currently implementing the LTE physical layer in Python (ver 2.7.7).
> > For the qpsk, 16qam and 64qam modulation I would like to know which is more
> > e
Hi,
I am currently implementing the LTE physical layer in Python (ver 2.7.7).
For the qpsk, 16qam and 64qam modulation I would like to know which is more
efficient to use, between an integer comparison and a list comparison:
Integer comparison: bit_pair as an integer value before comparison
I may be attempting something improper here, but maybe I'm just going
about it the wrong way. I'm subclassing
http.server.CGIHTTPRequestHandler, and I'm using a decorator to add
functionality to several overridden methods.
def do_decorate(func):
. def wrapper(self):
. if appropriate():
.
hat's probably a good thing.
I know there are a lot of computer types in the area, but there
doesn't seem to be much of a "community". I'd like to change that if
we can, so let me know if you're interested.
Austin
--
http://mail.python.org/mailman/listinfo/python-list
re or something if that's what it takes.
Thanks in advance!
Austin
--
http://mail.python.org/mailman/listinfo/python-list
H
and try again. This may not be the solution you ultimately end up
using, but it'll get you pointed in the right direction.
Austin
On Mon, Feb 8, 2010 at 5:52 PM, Terry Reedy wrote:
> On 2/7/2010 10:56 PM, 7H3LaughingMan wrote:
>>
>> To make the background information shor
Does the 'python' directory contain a file named '__init__.py'? This
is required to let that directory act as a package (see:
http://docs.python.org/tutorial/modules.html#packages); without it,
you'll see the symptoms you're seeing.
Austin
On Mon, Feb 8, 2010 at
That makes a lot of sense. And if I take the approach that any Py*
function might do this, it actually looks like I can simplify my code
(rather than managing some list of ill-behaved functions or
something.) Thanks!
On Fri, Jan 29, 2010 at 3:58 PM, Duncan Booth
wrote:
> Austin Bingham wr
ption
separately. The predicate that "a successful function won't modify the
error indicators" appears to be wrong, however, and I've modified my
code accordingly.
Austin
On Sat, Jan 30, 2010 at 1:11 AM, Gabriel Genellina
wrote:
> En Fri, 29 Jan 2010 18:25:14 -0300, Austin
s issue by checking function calls for failure?
Austin
On Fri, Jan 29, 2010 at 9:04 PM, Gabriel Genellina
wrote:
> En Fri, 29 Jan 2010 11:37:09 -0300, Austin Bingham
> escribió:
>
>> I've noticed that several (many?) python functions seem to clear the
>> error/exception indic
PyObject* mod = PyImport_ImportModule("sys");
assert(PyObject_HasAttrString(mod, "path"));
// Verify that the error indicator has been cleared
PyErr_Fetch(&t, &v, &tb);
assert(!t); // <=== The error is gone!
PyErr_Restore(t, v, tb);
Py_Finalize();
On Nov 1, 1:13 am, "Gabriel Genellina" wrote:
> Looks like in 3.1 this can be done with bytes+str and viceversa, even if
> bytes and str don't have a common ancestor (other than object; basestring
> doesn't exist in 3.x):
>
> p3> Base = bytes
> p3> Other = str
> p3>
> p3> class Derived(Base):
On Oct 29, 10:41 pm, "Gabriel Genellina"
wrote:
> We know the last test fails because the == logic fails to recognize mySet
> (on the right side) as a "more specialized" object than frozenset (on the
> left side), because set and frozenset don't have a common base type
> (although they share
On Oct 29, 3:54 pm, Mick Krippendorf wrote:
> Jess Austin wrote:
> > That's nice, but it means that everyone who imports my class will have
> > to import the monkeypatch of frozenset, as well. I'm not sure I want
> > that. More ruby than python, ne?
>
> I t
On Oct 28, 10:07 pm, Mick Krippendorf wrote:
> You could just overwrite set and frozenset:
>
> class eqmixin(object):
> def __eq__(self, other):
> print "called %s.__eq__()" % self.__class__
> if isinstance(other, (set, frozenset)):
> return True
> return su
I'm subclassing set, and redefining __eq__(). I'd appreciate any
relevant advice.
>>> class mySet(set):
... def __eq__(self, other):
... print "called mySet.__eq__()!"
... if isinstance(other, (set, frozenset)):
... return True
... return set.__eq__(self, o
denced by the abundance of proposals) but
"Can I get a particular behavior in a particular way?" (the answer to
which, again, seems to be no.)
Austin
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 15, 2009 at 7:49 PM, Ethan Furman wrote:
> Austin Bingham wrote:
> I'm feeling really dense about now... What am I missing?
What you're missing is the entire discussion up to this point. I was
looking for a way to use an alternative uniqueness criteria in a set
and an extra lookup on many
operations (extra time.) My original hope was to not have to do that.
Austin
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 15, 2009 at 5:15 PM, Gabriel Genellina
wrote:
> En Thu, 15 Oct 2009 11:42:20 -0300, Austin Bingham
> escribió:
> I think you didn't understand correctly Anthony Tolle's suggestion:
>
> py> class Foo:
> ... def __init__(self, name): self.name = na
set
with uniqueness defined over 'obj.name' would guarantee no name
collisions, dict only sorta helps me keep things straight; it doesn't
actually enforce that my values have unique names.
Austin
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 15, 2009 at 3:50 PM, Mick Krippendorf wrote:
> Austin Bingham schrieb:
> What you seem to imply is that the hash function imposes some kind of
> uniqueness constraint on the set which uses it. That's just not the
> case, the uniqueness constraint is always the (in-)eq
icts should have it as well I
> guess. Which opens a whole new can of worms.
dicts would certainly have to be looked at as well, but I don't think
the can would have that many worms in it if we solve the set issue to
everyone's satisfaction.
In any event, thanks for helping me work through this issue.
Austin
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 15, 2009 at 3:02 PM, Diez B. Roggisch wrote:
> Austin Bingham wrote:
> You do. Hashes can collide, and then you need equality. Sets are *based* on
> equality actually, the hash is just one optimization. ...
Right, thanks for clearing that up. Not reading closely enough
On Thu, Oct 15, 2009 at 2:23 PM, Diez B. Roggisch wrote:
> Austin Bingham wrote:
> This is a POV, but to to me, the set just deals with a very minimal
> protocol - hash-value & equality. Whatever you feed it, it has to cope with
> that. It strikes *me* as odd to ask for somethin
f a solution, I guess, but I would still need functionality
extrinsic to the dict. What I want is to make sure that no values in
my set have the same name, and dict won't guarantee that for me. A set
that calculated uniqueness based on its elements' names, on the other
hand, would.
Austin
On
a good one, but it's just not
what I am looking for.
Austin
On Thu, Oct 15, 2009 at 1:36 PM, Chris Rebert wrote:
> On Thu, Oct 15, 2009 at 4:24 AM, Austin Bingham
> wrote:
>> If I understand things correctly, the set class uses hash()
>> universally to calculate hash valu
s, say, 'hash(x.name)' rather than
'hash(x)'.
Is this possible? Am I just thinking about this problem the wrong way?
Admittedly, I'm coming at this from a C++/STL perspective, so perhaps
I'm just missing the obvious. Thanks for any help on this.
Austin Bingham
--
http://mail.python.org/mailman/listinfo/python-list
e, but perhaps
this is just a tricky problem for python. Any ideas or insight would
be great. Thanks!
Austin
--
http://mail.python.org/mailman/listinfo/python-list
l references to encryption? Of course I'm not asking for
actual legal advice, but can anyone think of any other part of the
code that might run afoul of export rules? Thanks.
Austin
--
http://mail.python.org/mailman/listinfo/python-list
or: cannot import name
to
TypeError: Error when calling the metaclass bases
depending on how I use import. Nothing seems to be the correct
combination. Any help would be much appreciated!
Austin
--
http://mail.python.org/mailman/listinfo/python-list
Arne Vajhøj wrote:
Xah Lee wrote:
For those of you imperative programers who kept on hearing about lisp
and is tempted to learn, then, ...
You:
* consider yourself unfairly treated by various communities
* post a long drivel about various Lisp flavors to newsgroups
that are not in any way Li
cept
(FooError, BarError) tuple syntax.
I've never hacked on CPython itself, so I don't know what kind of
changes there would be involved, but if there is sufficient pushback
against making GeneratorExit derive from BaseException, I think this is
a fine alternative. Thoughts?
Chad
Chad
Hi Terry,
Thank you for your feedback. Responses inline:
Terry Reedy wrote:
> "Chad Austin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> || try:
> | result = yield chatGateway.checkForInvite({'userId': userId})
> | logger.i
than
(correctly) bubbling out of the task. GeneratorExit is similar in
practice to SystemExit here, so it would make sense for it to be a
BaseException as well.
So, my proposal is that GeneratorExit derive from BaseException instead
of Exception.
p.s. Should I have sent this mail to pytho
"The Night Blogger" <[EMAIL PROTECTED]> writes:
> Is there a way to pull & push data into (Apple Mac OS X Calendar) Ical from
> Python ?
>
see: http://vobject.skyhouseconsulting.com/
-- regards, Phil
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
>> This is the .NET 11 SDK, I belive it includes the 2003 compiler (*):
>
> Last time I checked the .NET SDK they had the C# compiler in there, but
> not the C++ optimizing 2003 compiler. Might be wrong though
I just downloaded and installed this, and see a directory
get an exception that
unambiguously shows what's going on rather than having random crashes reported
in the field.
Chad
Chad Austin wrote:
> Hi all,
>
> My first post to the list. :) I'm debugging one of our application
> crashes, and I thought maybe one of you has seen something s
tly appreciated...
We're using Python 2.3.5 and Visual C++ 6.
--
Chad Austin
http://imvu.com/technology
--
http://mail.python.org/mailman/listinfo/python-list
Michael McNeil Forbes <[EMAIL PROTECTED]> writes:
>
> I find that version control (VC) has many advantages for
> scientific research (I am a physicist).
>
Greg Wilson also makes that point in this note:
http://www.nature.com/naturejobs/2005/050728/full/nj7050-600b.html
Where he describes his exc
Bryan,
You'll get the same result without the lock. I'm not sure what this
indicates. It may show that the contention on the lock and the race
condition on i aren't always problems. It may show that generators, at
least in CPython 2.4, provide thread safety for free. It does seem to
disprove m
I just noticed, if you don't define maxsize in _init(), you need to
override _full() as well:
def _full(self):
return False
cheers,
Jess
--
http://mail.python.org/mailman/listinfo/python-list
Paul wrote:
>def f():
>lock = threading.Lock()
>i = 0
>while True:
>lock.acquire()
>yield i
>i += 1
>lock.release()
>
> but it's easy to make mistakes when implementing things like that
> (I'm not even totally confident tha
Alex wrote:
> Last, I'm not sure I'd think of this as a reentrantQueue, so
> much as a ReentrantCounter;-).
Of course! It must have been late when I named this class... I think
I'll go change the name in my code right now.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the great advice, Alex. Here is a subclass that seems to
work:
from Queue import Queue
from itertools import count
class reentrantQueue(Queue):
def _init(self, maxsize):
self.maxsize = 0
self.queue = [] # so we don't have to override put()
self.counter =
I guess we think a bit differently, and we think about different
problems. When I hear, "immutable container", I think "tuple". When I
hear, "my own class that is an immutable container", I think, "subclass
tuple, and probably override __new__ because otherwise tuple would be
good enough as is".
msoulier wrote:
> I find that DP junkies don't tend to keep things simple.
+1 QOTW. There's something about these "political" threads that seems
to bring out the best quotes. b^)
--
http://mail.python.org/mailman/listinfo/python-list
hi,
This seems like a difficult question to answer through testing, so I'm
hoping that someone will just know... Suppose I have the following
generator, g:
def f()
i = 0
while True:
yield i
i += 1
g=f()
If I pass g around to various threads and I want them to always be
y
To be clear, in this simple example I gave you don't have to override
anything. However, if you want to process the values you place in the
container in some way before turning on immutability (which I assume
you must want to do because otherwise why not just use a tuple to begin
with?), then that
Since this is a container that needs to be "immutable, like a tuple",
why not just inherit from tuple? You'll need to override the __new__
method, rather than the __init__, since tuples are immutable:
class a(tuple):
def __new__(cls, t):
return tuple.__new__(cls, t)
cheers,
Jess
--
hi,
I'm not sure why this hasn't come up yet, but this seems to beg for
list comprehensions, if not generator expressions. All of the
following run in under 2 seconds on my old laptop:
>>> alph = 'abcdefghijklmnopqrstuvwxyz'
>>> len([''.join((a,b,c,d)) for a in alph for b in alph for c in alph f
"Travis E. Oliphant" <[EMAIL PROTECTED]> writes:
> Krish wrote:
> Yes, you are right that you need to use typemaps. It's been awhile
> since I did this kind of thing, but here are some pointers.
Also, there's http://geosci.uchicago.edu/csc/numptr
--
http://mail.python.org/mailman/listinfo/p
Robert Kern <[EMAIL PROTECTED]> writes:
> Lenny G. wrote:
>> Is there a way to make a c/c++ extension have a useful method
>> signature? Right now, help(myCFunc) shows up like:
>> myCFunc(...)
>> description of myCFunc
>> I'd like to be able to see:
>> myCFunc(myArg1, myArg2)
>> description o
Well, that answers that. Thank you!
--
http://mail.python.org/mailman/listinfo/python-list
Hello, I just started with python and have run into a problem using
lists.
If I enter:
li = [.25,.10,.05,.01]
and then enter:
print li
it'll output:
[0.25, 0.10001, 0.050003, 0.01]
Can anyone tell me why it does this, and how I can get just the value
.10, and .
class HelloService(win32serviceutil.ServiceFramework):
_svc_name_ = "HelloService"
_svc_display_name_ = "Hello Service"
def __init__(self,args):
win32serviceutil.ServiceFramework.__init__(self,args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
self.c
My program is running on windows and it is wrritten by Python and wxPython,
built by py2exe.
If my program is executed minimized, and the user want to shutdown or
reboot.
Meanwhile, my program is running and it has several threads running, too.
The shutdown or reboot will cause a error of my progr
I use py2exe to build python program to "aa.exe".
If this program has a bug, after closed this program, it will show
"aa.exe.log" in this folder.
Is there any ways to avoid this log file?
--
http://mail.python.org/mailman/listinfo/python-list
I would like to write a program which creates the folders in specific
directory.
For example, I want to create folder in Program Files. How do I know which
is in C:\ or D:\
Is there any function to get the active path?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
>> My code is " os.system("NET SEND computer hihi") "
>> i use this funtion on Windows server 2003.
>> it's ok.
>>
>> But the same code running on Windows XP SP2, it shows the command window
>> twice.
>> How do i remove the command window?
>
> Hi,
>
> You can remove the command window which comes
My code is " os.system("NET SEND computer hihi") "
i use this funtion on Windows server 2003.
it's ok.
But the same code running on Windows XP SP2, it shows the command window
twice.
How do i remove the command window?
--
http://mail.python.org/mailman/listinfo/python-list
I produced 5 wxTextCtrl.
My program is to let the user enter the serial number.
Each wxTextCtrl has 4 maxlength.
My ideal is
if the user enter 4 digits on first wxTextCtrl, and the program will move
the cursor to the second wxTextCtrl.
I checked the wxTextCtrl::SetInsertingPoint.
But this function
I wrote a GUI program on windows. (python & wxPython)
One function is to refresh the data from the COM Object continously.
In the beginning, I used the thread.start_new_thread(xxx,())
But no matter how i try, it will cause the win32com error.
After that, i use the wx.Timer to do the refresh functi
My codes are below:
***
import win32evtlog
def check_records(records):
for i in range(0,len(records)):
print records[i].SourceName
h = win32evtlog.OpenEventLog(None,"System")
flags =
win32evtlog.EVENTLOG_BACKWARD_READ|win32evtlog.EVENTLOG_SEQUENTIAL_R
I wrote a GUI program with wxPython.
In the window, there are 3 attributes on left top.
"_" could let the program to minimize to tool bar.
I want to let the program minimized to the system tray.
Is there any way to let the window have 4 attributes?
"." "_" "O " "x"
--
http://mail.python.org/m
here is another thread running
background.
> Austin wrote:
>> I wrote a program running on windows.
>> I put the link of the program in "Start up" folder and let it executed
>> minimized.
>> Every time when I open the computer, my program will be running i
I wrote a program running on windows.
I put the link of the program in "Start up" folder and let it executed
minimized.
Every time when I open the computer, my program will be running in system
tray.
But if the user would like to shutdown the computer, the OS will show an
error about exception.
'pythonw setup.py py2exe', I see 2 folders, 'dist' & 'build'
which is the same as py2exe.
I open the 'dist' folder and see a file 'main'. Then I double-click the
'main' and appeared the error message.
'IOError:[Errno 2] No suc
On Red Hat 9, Python is installed by default and it's version is 2.2.2
If I want to upgrade Python to 2.3.4(newer version), how could I do?
If I compile source code of Python, how do I uninstall the old version?
I tried rpm packages but failed with dependence.
Could everyone give me a advise?
--
72 matches
Mail list logo