>
> > Hi All,
> > I need to call a function for evry 10 secs
> > how can i achieve this in python
>
>
> import time
> while True:
>time.sleep(10)
>function()
>
Please don't reinvent the wheel...
Use the python apscheduler module.
http://packages.python.org/APScheduler/#installing-apsche
Hi,
just want to use poll method to get data from /proc file system. Use
simple code for it. Problem is it seems poll return POLLIN flag but
when I try to read data it's always empty. Could be a problem changes
are so fast that print can't print it?
Code:
#!/usr/bin/python
import select
from se
Hello,
I'm trying to gather some mail and save it. I don't get why it isn't saved
as expected.
==
>>> import poplib, socket, sys
>>> from configparser import Error as ProtocolError
>>> args= sys.argv[1:] # this is fake but i
On 7/1/11 11:15 AM, Alister Ware wrote:
The subject probably say is all but to elaborate.
I am looking for a way to communicate with a tapi driver for a PBX so I
can experiment with creating some CTI (Computer Telephony Integration)
software.
I used TAPI since its inception for quite a few pro
This code is working:
> try:
> ffmpeg_proc = subprocess.Popen(queue[position].ffmpeg_cmd,
> stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
> except WindowsError as exc:
> log_windows_error(exc, queue[position].ffmpeg_cmd, 'critical')
> break
> if queue[pos
TheSaint wrote:
> Hello,
> I'm trying to gather some mail and save it. I don't get why it isn't saved
> as expected.
Short answer: you need to seek the fp file object back to the start of the
file by calling fp.seek(0). Otherwise, when you add it to the mail box, if
gets EOF immediately and nothi
On Jul 2, 3:46 am, Corey Richardson wrote:
> Excerpts from H Linux's message of Fri Jul 01 16:02:15 -0400 2011:
>
> > Dear all,
>
> > I am currently fighting with a problem writing a set of Python
> > extensions in C.
>
> If you haven't seen it yet, Cython is a *very* nice tool for writing
> C ext
On Jul 2, 2:28 am, Carl Banks wrote:
> On Friday, July 1, 2011 1:02:15 PM UTC-7, H Linux wrote:
> > Once I try to nest this, I cannot get the module to load anymore:
> > >import smt.bar
> > Traceback (most recent call last):
> > File "", line 1, in
> > ImportError: No module named bar
>
> [snip
kozmikyak wrote:
> Does anyone here have a Python 3 environment that can access MSSQL
> using SQLAlchemy, running on a Windows 7 box? If so, I would like
> some assistance making it happen.
>
> The last post on this was mid-2010. It was mentioned that pyodbc had
> a Python 3 branch. I've been un
Steven D'Aprano wrote:
Thank you very much.
> But if you seek back to the beginning:
>
x.seek(0)
> 0
x.read()
> b'hello'
>
Found the matter and *is* working
I discover another problem:
one message contains also a different encoding, but mostly it is not
possible to represent that wr
TP wrote:
> Thomas 'PointedEars' Lahn wrote:
>> [Why are threads broken in the newsgroup?]
>
> Not sure if this is relevant. I use mail.google.com to follow mailing
> lists and a large proportion of python-list traffic ends up in my
> gmail spam folder for some reason?
Your e-mail problems are u
I've built a Python app for the iPhone, http://www.sabonrai.com/PythonMath/.
Like embedding Python in another app, it uses PyRun_SimpleString() to
execute commands entered by the user. For evaluating expressions, it
uses PyEval_EvalCode() with the dictionary from the __main__ module.
Future divis
I thought I had finally grasped decorators, but the error I'm getting
('str' type is not callable) is confusing me. Here is my code. Also,
the commented sentence is from the Python docs, which says it doesn't
even need to be callable, if that matters. I also commented out a few
things in the move m
On 02/07/2011 17:56, John Salerno wrote:
I thought I had finally grasped decorators, but the error I'm getting
('str' type is not callable) is confusing me. Here is my code. Also,
the commented sentence is from the Python docs, which says it doesn't
even need to be callable, if that matters. I al
On Sat, 02 Jul 2011 11:40:46 +0200, Belisko Marek wrote:
> just want to use poll method to get data from /proc file system. Use
> simple code for it. Problem is it seems poll return POLLIN flag but
> when I try to read data it's always empty. Could be a problem changes
> are so fast that print can
On Fri, 01 Jul 2011 14:28:13 -1000, Werner Thie wrote:
> On 7/1/11 11:15 AM, Alister Ware wrote:
>> The subject probably say is all but to elaborate.
>>
>> I am looking for a way to communicate with a tapi driver for a PBX so I
>> can experiment with creating some CTI (Computer Telephony Integrati
On Jul 2, 12:33 pm, MRAB wrote:
> On 02/07/2011 17:56, John Salerno wrote:
>
>
>
>
>
>
>
>
>
> > I thought I had finally grasped decorators, but the error I'm getting
> > ('str' type is not callable) is confusing me. Here is my code. Also,
> > the commented sentence is from the Python docs, which
hi i need help with extending this http://paste.pound-python.org/show/8918/
c code so that it can initiate this python script
http://paste.pound-python.org/show/8917/
and export file path here..
btw I tried to run following python code :
#include //changed this to python2.7/Python.h
didn't work
On 07/02/2011 01:08 PM, John Salerno wrote:
On Jul 2, 12:33 pm, MRAB wrote:
roll_die = move(roll_die)
You should be defining a function (a callable) and then passing it to a
decorator which returns a callable.
But why does the documentation say "The return value of the decorator
need n
On Sat, Jul 2, 2011 at 12:08 PM, John Salerno wrote:
> But why does the documentation say "The return value of the decorator
> need not be callable"?
Because the language does not enforce the restriction that the return
value should be a callable. If it's not a callable, then the result
will jus
On Jul 2, 11:08 am, John Salerno wrote:
> On Jul 2, 12:33 pm, MRAB wrote:
>
>
>
> > On 02/07/2011 17:56, John Salerno wrote:
>
> > > I thought I had finally grasped decorators, but the error I'm getting
> > > ('str' type is not callable) is confusing me.
> > > def move(roll):
> > > return 'Y
On Jul 2, 11:08 am, John Salerno wrote:
> On Jul 2, 12:33 pm, MRAB wrote:
>
>
>
> > On 02/07/2011 17:56, John Salerno wrote:
>
> > > I thought I had finally grasped decorators, but the error I'm getting
> > > ('str' type is not callable) is confusing me.
> > > def move(roll):
> > > return 'Y
On Jul 2, 11:08 am, John Salerno wrote:
> On Jul 2, 12:33 pm, MRAB wrote:
>
>
>
> > On 02/07/2011 17:56, John Salerno wrote:
>
> > > I thought I had finally grasped decorators, but the error I'm getting
> > > ('str' type is not callable) is confusing me.
> > > def move(roll):
> > > return 'Y
On Sat, Jul 2, 2011 at 2:40 AM, Belisko Marek wrote:
> Hi,
>
> just want to use poll method to get data from /proc file system. Use
> simple code for it. Problem is it seems poll return POLLIN flag but
> when I try to read data it's always empty. Could be a problem changes
> are so fast that print
Is there a decent way of running "from import *"? Perhaps using
__import__?
Does it mean using the copy module or adding an element to globals()
somehow?
Yes, I think I do have a good use for this: importing either pure python or
cython versions of a module into a single namespace that can prov
Terry writes:
> Future division ("from __future__ import division") works within
> scripts executed by import or execfile(). However, it does not work
> when entered interactively in the interpreter like this:
>
from __future__ import division
a=2/3
Are you referring to the interactive
On Jul 2, 1:45 pm, Tim Chase wrote:
> I must not be looking at the same documentation you are...could
> you provide a link? The only time I know of that the return value
> of a decorator need not be callable is if you want to totally
> break the syntax of the function. :-/
http://docs.python.org
On Saturday, July 2, 2011 6:35:19 AM UTC-7, H Linux wrote:
> On Jul 2, 2:28 am, Carl Banks
> wrote:
> > On Friday, July 1, 2011 1:02:15 PM UTC-7, H Linux wrote:
> > > Once I try to nest this, I cannot get the module to load anymore:
> > > >import smt.bar
> > > Traceback (most recent call last):
>
I have written two EXTREMELY simple python classes. One class
(myClass1) contains a data attribute (myNum) that contains an integer.
The other class (myClass2) contains a data attribute (mySet) that
contains a set.
I instantiate 2 instances of myClass1 (a & b). I then change the value
of a.myNum
On Sat, Jul 2, 2011 at 2:59 PM, Saqib Ali wrote:
> Then I instantiate 2 instances of myClass2 (c & d). I then change the
> value of c.mySet. Bizarrely changing the value of c.mySet also affects
> the value of d.mySet which I haven't touched at all!?!?! Can someone
> explain this very strange beha
Saqib Ali wrote:
>
>
> I have written two EXTREMELY simple python classes. One class
> (myClass1) contains a data attribute (myNum) that contains an integer.
> The other class (myClass2) contains a data attribute (mySet) that
> contains a set.
>
> I instantiate 2 instances of myClass1 (a & b).
> Instance variables are properly created in the __init__()
> initializer method, *not* directly in the class body.
>
> Your class would be correctly rewritten as:
>
> class MyClass2(object):
> def __init__(self):
> self.mySet = sets.Set(range(1,10))
>
> def clearSet(self):
> # ...r
John Salerno writes:
> Basically what I want to do is this: I first to need to roll a die to
> get a random number, then pass that number to the move method of a
> Player class. Can this be done with a decorator, or is it better just
> to do it like move(roll_die()) and be done with it?
If what
Belisko Marek wrote:
>
>just want to use poll method to get data from /proc file system. Use
>simple code for it. Problem is it seems poll return POLLIN flag but
>when I try to read data it's always empty. Could be a problem changes
>are so fast that print can't print it?
Poll doesn't make sense
Hello fellow programmers, scripters, hackers, and debutantes.
I have cross posted this thread to three groups that i believe need to
unite under the flag of unity for the benefit of all. Because when we
unite we not only help ourselves, we promote freedom. In the next few
paragraphs i will expose
On Sat, Jul 2, 2011 at 3:23 PM, Saqib Ali wrote:
>> Instance variables are properly created in the __init__()
>> initializer method, *not* directly in the class body.
>>
>> Your class would be correctly rewritten as:
>>
>> class MyClass2(object):
>> def __init__(self):
>> self.mySet =
I know I shouldn't get sucked into responding to a rant, but it's like
a black hole - it's inevitable you'll cross the horizon...
On Sun, Jul 3, 2011 at 8:59 AM, rantingrick wrote:
> It saddens me when i see API's that don't include at least three
> language choices. No *one* language is going to
On Jul 2, 6:38 pm, Chris Angelico wrote:
[... snip expositions...]
> C or C++ bindings will cover most languages.
>
> Chris Angelico
This is pretty much the entire argument, everything else is
exposition.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 2, 3:55 pm, Hrvoje Niksic wrote:
> Terry writes:
> > Future division ("from __future__ import division") works within
> > scripts executed by import or execfile(). However, it does not work
> > when entered interactively in the interpreter like this:
>
> from __future__ import divisio
On Jul 2, 6:38 pm, Chris Angelico wrote:
[...]
> It takes work to suit your API to a different language. Let's take GNU
> Aspell as an example; [...] Should the Aspell team offer bindings for every
> known language? In your post, you recommend supporting a minimum of
> three. Which three? Why?
No
On Sun, Jul 3, 2011 at 10:21 AM, rantingrick wrote:
> No. Aspell should offer bindings for THE "Unity API" and the
> respective "abstraction communities" are then responsible for
> maintaining a plugin for their "abstraction" into THE Unity API.
>
Your proposed "Unity API" (which I assume has not
On Sat, Jul 2, 2011 at 5:21 PM, rantingrick wrote:
> On Jul 2, 6:38 pm, Chris Angelico wrote:
> [...]
> > It takes work to suit your API to a different language. Let's take GNU
> > Aspell as an example; [...] Should the Aspell team offer bindings for
> every
> > known language? In your post, you
On Sun, Jul 3, 2011 at 8:23 AM, Saqib Ali wrote:
> So just out of curiosity, why does it work as I had expected when the
> member contains an integer, but not when the member contains a set?
It's not integer vs set; it's the difference between rebinding and
calling a method. It's nothing to do wi
Take Pidgin[1] as an example. Pidgin is a universal chat client. It's
a glue between the many chat clients that exist... It's a monkey patch
for chat multiplicity but you get the idea. However the Unity API
cannot be a monkey patch. It must be a mutual undertaking from the
beginning. Don't you peo
On Sat, Jul 2, 2011 at 5:46 PM, Chris Angelico wrote:
> On Sun, Jul 3, 2011 at 8:23 AM, Saqib Ali wrote:
>> So just out of curiosity, why does it work as I had expected when the
>> member contains an integer, but not when the member contains a set?
>
> It's not integer vs set; it's the difference
On 07/02/2011 06:46 PM, rantingrick wrote:
On Jul 2, 6:38 pm, Chris Angelico wrote:
It saddens me when i see API's that don't include at least three
language choices. No *one* language is going to please the masses.
C or C++ bindings will cover most languages.
This is pretty much the entire
On Sun, Jul 3, 2011 at 10:58 AM, rantingrick wrote:
>
> Take Pidgin[1] as an example. Pidgin is a universal chat client. It's
> a glue between the many chat clients that exist... It's a monkey patch
> for chat multiplicity but you get the idea. However the Unity API
> cannot be a monkey patch. It
On Sun, Jul 3, 2011 at 11:07 AM, Chris Rebert wrote:
> c,d
>> ({}, [])
>
> Nasty typo in your pseudo-interpreter-session there...
Whoops! This is what I get for trying to be too smart!
>>> c,d
([], [])
Thanks for catching that, Chris. :)
(another) Chris
--
http://mail.python.org/mailman/l
Hey guys,
I am new to python. I want to make a shortcut that opens my websites
and re-sizes them to display on different areas on the screen. I looked
around but i had no luck. Is that possible with python? if so can someone
point to to the right direction? Here is what I came up with so far..
T
On Jul 2, 8:12 pm, Chris Angelico wrote:
> Any universal protocol will suffer either from complexity or
> narrowness - some suffer from both. If every API has to go through
> this Unity API, then either Unity will be as powerful and complex as C
> with all its libraries, or it'll overly restrict
On Sun, Jul 3, 2011 at 11:43 AM, rantingrick wrote:
> I mean what is the point of having two languages with the exact same
> syntax?
>
> Ruby: print 'blah'
> Python: print 'blah'
>
> Ruby: for x in blah: blah_blah_blah
> Python: for x in blah: blah_blah_blah
>
> WHAT?
>
What's the point of having
> On Sat, Jul 2, 2011 at 7:37 PM, Dan Stromberg wrote:
>
> Adding a new API is seldom the way to decrease the number of API's.
> At least, not without -=very=- centralized control over which API's
> get used.
>
> I actually rather like it that no language has achieved the
> dominance today that C o
On Sat, Jul 2, 2011 at 6:21 PM, Dustin Cheung wrote:
> Hey guys,
> I am new to python. I want to make a shortcut that opens my websites
> and re-sizes them to display on different areas on the screen. I looked
> around but i had no luck. Is that possible with python? if so can someone
> point to
John Salerno wrote:
> But why does the documentation say "The return value of the decorator
> need not be callable"?
The thing returned by a decorator does not need to be callable, but if you
want to call it, then it better be!
This is no different from this:
my_func = "hello world"
my_func()
On Jul 2, 9:11 pm, Steven D'Aprano wrote:
> John Salerno wrote:
> > But why does the documentation say "The return value of the decorator
> > need not be callable"?
>
> The thing returned by a decorator does not need to be callable, but if you
> want to call it, then it better be!
>
> This is no d
Just thought I'd post this in the event anyone has a few spare minutes
and feels like tearing apart a fairly simple attempt to write a
game. :)
I'll paste the exercise I was working on first, although I think it
was meant to be an exercise in how to use lists. I went way beyond
that, so maybe my p
On Jul 2, 8:49 pm, Chris Angelico wrote:
> On Sun, Jul 3, 2011 at 11:43 AM, rantingrick wrote:
> > I mean what is the point of having two languages with the exact same
> > syntax?
>
> > Ruby: print 'blah'
> > Python: print 'blah'
>
> > Ruby: for x in blah: blah_blah_blah
> > Python: for x in blah
Saqib Ali wrote:
> I have written two EXTREMELY simple python classes. One class
> (myClass1) contains a data attribute (myNum) that contains an integer.
> The other class (myClass2) contains a data attribute (mySet) that
> contains a set.
>
> I instantiate 2 instances of myClass1 (a & b). I then
On Sun, Jul 3, 2011 at 12:19 PM, John Salerno wrote:
> Just thought I'd post this in the event anyone has a few spare minutes
> and feels like tearing apart a fairly simple attempt to write a
> game. :)
Sure! You seem to comprehend the basics, which is an order of
magnitude better than some peopl
> On Sat, Jul 2, 2011 at 7:10 PM, Chris Rebert wrote:
>> On Sat, Jul 2, 2011 at 6:21 PM, Dustin Cheung wrote:
>> > Hey guys,
>> > I am new to python. I want to make a shortcut that opens my websites
>> > and re-sizes them to
>> > point to to the right direction? Here is what I came up with so far
On Sun, Jul 3, 2011 at 12:24 PM, rantingrick wrote:
> Why do you constantly propagate multiplicity? Why do you feel that we
> need 100 or so languages when about three would cover everything? Sure
> people are free to create whatever Frankenstein language they want in
> the confines of their hobby
rantingrick wrote:
> Hello fellow programmers, scripters, hackers, and debutantes.
Your ideas are intriguing to me and I wish to subscribe to your newsletter.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 2, 10:02 pm, Chris Angelico wrote:
> > game_information = '***Chutes and Ladders***\nUp to four (4) players
> > may play.\n'\
> > 'There are 90 spaces on the board. '\
> > 'The player to reach space 90 first wins.'
>
> I'd do this with a triple-quoted st
The place where this "Unity API" idea of yours falls down
is that an API is only truly easy to use when it's designed
to closely match the characteristics of the language it's
being used from.
For example, Python has a very powerful feature that most
other languages don't have anything remotely l
On Sun, Jul 3, 2011 at 1:41 PM, John Salerno wrote:
> Yeah, I considered that, but I just hate the way it looks when the
> line wraps around to the left margin. I wanted to line it all up under
> the opening quotation mark. The wrapping may not be as much of an
> issue when assigning a variable li
rantingrick wrote:
Ruby: for x in blah: blah_blah_blah
Python: for x in blah: blah_blah_blah
Here you're making the mistake of thinking that surface syntax
is all that matters. Although the 'for' statements in Python and
Ruby look very similar, underneath they're based on quite
different mecha
Chris Angelico wrote:
Your proposed "Unity API" (which I assume has nothing to do with Natty
Narwhal's preferred interface) already exists. It's the C language.
Or maybe GObject Introspection is closer to what you
have in mind?
A library that supports GI advertises enough information
about it
On Jul 2, 10:14 pm, Chris Angelico wrote:
> I specced up "the perfect language" a while ago. It gave you a clean
> slate with no facilities but one: Define Operator. [...]
That was some great satire :) but the last thing we need is users with
that much power. Take the example of Ruby allowing you
Ian Kelly wrote:
If it's not a callable, then the result
will just be that something non-callable is bound to the "roll_die"
name -- which could be useful, but is probably a bad idea in general.
There are legitimate uses -- for example, the following
is a convenient way of creating a read-only
On Jul 2, 10:57 pm, Gregory Ewing wrote:
> The place where this "Unity API" idea of yours falls down
> is that an API is only truly easy to use when it's designed
> to closely match the characteristics of the language it's
> being used from.
>
> For example, Python has a very powerful feature that
On Jul 2, 11:00 pm, Gregory Ewing wrote:
> rantingrick wrote:
> > Ruby: for x in blah: blah_blah_blah
> > Python: for x in blah: blah_blah_blah
>
> Here you're making the mistake of thinking that surface syntax
> is all that matters. Although the 'for' statements in Python and
> Ruby look very sim
rantingrick wrote:
> Turned my otherwise beautiful code into an Orwellian nightmare.
Your code was spying on you, having your friends and family disappear during
the night to be tortured, and having history re-written so that there was
no longer any evidence that they ever existed?
You have my s
On 7/2/2011 12:52 PM, Dan Stromberg wrote:
Is there a decent way of running "from import *"? Perhaps
using __import__?
Does it mean using the copy module or adding an element to globals()
somehow?
Yes, I think I do have a good use for this: importing either pure python
or cython versions of
73 matches
Mail list logo