Re: How to filter a dictionary ?

2012-04-09 Thread Nikhil Verma
Thanks Shashank . It worked. On Tue, Apr 10, 2012 at 11:34 AM, Shashank Singh < shashank.sunny.si...@gmail.com> wrote: > > > On Mon, Apr 9, 2012 at 10:49 PM, Nikhil Verma wrote: > >> >> for_patient_type = {37: u'Test', 79: u'Real', 80: u'Real', 81: u'Real', >> 83: u'Real', 84: u'Real', 91: u'Real

Re: How to filter a dictionary ?

2012-04-09 Thread Shashank Singh
On Mon, Apr 9, 2012 at 10:49 PM, Nikhil Verma wrote: > > for_patient_type = {37: u'Test', 79: u'Real', 80: u'Real', 81: u'Real', > 83: u'Real', 84: u'Real', 91: u'Real', 93: u'Real'} > > I want if the values are 'Real' give me the keys that have values 'Real' > like this. > > {79:'Real'} > {80:'Re

Re: use Python to post image to Facebook

2012-04-09 Thread Shashank Singh
I wrote something like this a little while ago, may be this is what you are looking for: http://rationalpie.wordpress.com/2011/02/12/posting-photo-to-wall-using-facebook-graph-api/ On Mon, Apr 9, 2012 at 8:46 PM, CM wrote: > > I've tried using fbconsole[1] and facepy[2], both of which apparently

Re: use Python to post image to Facebook

2012-04-09 Thread CM
> I've tried using fbconsole[1] and facepy[2], both of which apparently Forgot the refs: [1]https://github.com/facebook/fbconsole; http://blog.carduner.net/2011/09/06/easy-facebook-scripting-in-python/ [2]https://github.com/jgorset/facepy -- http://mail.python.org/mailman/listinfo/python-list

use Python to post image to Facebook

2012-04-09 Thread CM
Shot in the dark here: has any who reads this group been successful with getting Python to programmatically post an image to Facebook? I've tried using fbconsole[1] and facepy[2], both of which apparently work fine for their authors and others and although I have an authorization code, publish pe

Re: Interrupting a blocking function frolm another thread.

2012-04-09 Thread superhac007
On Monday, April 9, 2012 9:39:54 AM UTC-5, super...@gmail.com wrote: > On Apr 8, 8:09 pm, Adam Skutt wrote: > > On Apr 8, 5:52 pm, superhac...@gmail.com wrote: > > > > > > > > > > > > > > > > > > > > > On Sunday, April 8, 2012 3:55:41 PM UTC-5, Adam Skutt wrote: > > > > On Apr 8, 2:45 pm, "superha

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Cameron Simpson
On 09Apr2012 12:02, Janis wrote: | Thank you all for the help! I will need to think a bit about the other | suggestions. | | But, Alan, as to this: | > > How do you get -9 and -15? Exit status is supposed to be between 0 and | > > 127. | | I have the following code that has caught these: | | p

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Dan Stromberg
You might try running your Python process with: strace -f -s 1024 -o /tmp/script.strace python /path/to/script.py Then you (perhaps with a C programmer) can likely track down what happened right before the crash by examining the system call tracer near the end of the file. http://stromberg.dns

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Martin P. Hellwig
On 09/04/2012 11:01, Janis wrote: My experience is that these kind of behaviors are observed when (from most to least likeliness): - Your kernel barfs on a limit, e.g. space/inodes/processes/memory/etc. - You have a linked library mismatch - You have bit rot on your system - You have a faulty l

Re: functions which take functions

2012-04-09 Thread Emile van Sebille
On 4/9/2012 11:57 AM Kiuhnm said... Do you have some real or realistic ... yes (but easy and self-contained) aah, no. examples when you had to define a (multi-statement) function and pass it to another function? This weekend I added functionality to a subsystem that allows users to

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread Roy Smith
In article <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, aapeetnootjes wrote: > I'm trying out the pygame tutorial at > http://www.pygame.org/docs/tut/intro/intro.html > If I try out the code I'm facing an error: > ./game.py: line 4: syntax error at unexpected symbol 'si

Re: Python Gotcha's?

2012-04-09 Thread Stefan Schwarzer
Hi Miki, On 2012-04-05 00:34, Miki Tebeka wrote: > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) please > share. > > (Note that I want over http://wiki.python.org/moin/PythonWarts already). I gave a somewhat similar tal

Re: f python?

2012-04-09 Thread Rainer Weikusat
Rainer Weikusat writes: > Shmuel (Seymour J.) Metz writes: > > [...] > >>>For one thing, if s is a non-empty null terminated string then, >>>cdr(s) is also a string representing the rest of that string >>>without the first character, >> >> Are you really too clueless to differentiate between C a

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread MRAB
On 09/04/2012 21:20, aapeetnootjes wrote: I'm trying out the pygame tutorial at http://www.pygame.org/docs/tut/intro/intro.html If I try out the code I'm facing an error: ./game.py: line 4: syntax error at unexpected symbol 'size' ./game.py: line 4: `size = width, height = 320, 240' can anyone

Re: functions which take functions

2012-04-09 Thread Terry Reedy
On 4/9/2012 2:57 PM, Kiuhnm wrote: Do you have some real or realistic (but easy and self-contained) examples when you had to define a (multi-statement) function and pass it to another function? This is so common in Python that it is hardly worth sneezing about. map(f, iterable) filter(f, itera

Re: f python?

2012-04-09 Thread Rainer Weikusat
Shmuel (Seymour J.) Metz writes: [...] >>For one thing, if s is a non-empty null terminated string then, >>cdr(s) is also a string representing the rest of that string >>without the first character, > > Are you really too clueless to differentiate between C and LISP? In LISP, a list is a set o

[newbie] help with pygame-tutorial

2012-04-09 Thread aapeetnootjes
I'm trying out the pygame tutorial at http://www.pygame.org/docs/tut/intro/intro.html If I try out the code I'm facing an error: ./game.py: line 4: syntax error at unexpected symbol 'size' ./game.py: line 4: `size = width, height = 320, 240' can anyone here tell me what's going wrong? thanks --

ASTRONOMY IN THE QUR'AN

2012-04-09 Thread BV BV
THE QUR'AN AND MODERN SCIENCE Extracted from the Book The Bible, The Qur'an and Science Maurice Bucaille ASTRONOMY IN THE QUR'AN The Qur'an is full of reflections on the heavens. In the preceding chapter on the Creation, we saw how the plurality of the heavens and ear

Re: Question on Python 3 shell restarting

2012-04-09 Thread Terry Reedy
On 4/9/2012 8:09 AM, Albert W. Hopkins wrote: On Sun, 2012-04-08 at 20:09 +0200, Franck Ditter wrote: How may I get a fresh Python shell with Idle 3.2 ? I have to run the same modules several times with all variables cleared. If you have the module in an idle edit window, F5-run restarts after

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Janis
Thank you all for the help! I will need to think a bit about the other suggestions. But, Alan, as to this: > > How do you get -9 and -15? Exit status is supposed to be between 0 and > > 127. I have the following code that has caught these: p = subprocess.Popen([Config.PYTHON_EXE,'Load.py',"%s"

Re: f python?

2012-04-09 Thread Kaz Kylheku
On 2012-04-09, Roy Smith wrote: > In article <4f82d3e2$1$fuzhry+tra$mr2...@news.patriot.net>, > Shmuel (Seymour J.) Metz wrote: > >> >Null terminated strings have simplified all kids of text >> >manipulation, lexical scanning, and data storage/communication >> >code resulting in immeasurable sa

Re: f python?

2012-04-09 Thread Kaz Kylheku
On 2012-04-09, Shmuel Metz wrote: > In <20120408114313...@kylheku.com>, on 04/08/2012 >at 07:14 PM, Kaz Kylheku said: > >>Null-terminated strings are infinitely better than the ridiculous >>encapsulation of length + data. > > ROTF,LMAO! > >>For one thing, if s is a non-empty null terminated s

Re: ordering with duck typing in 3.1

2012-04-09 Thread Jon Clements
On Monday, 9 April 2012 12:33:25 UTC+1, Neil Cerutti wrote: > On 2012-04-07, Jon Clements wrote: > > Any reason you can't derive from int instead of object? You may > > also want to check out functions.total_ordering on 2.7+ > > functools.total_ordering > > I was temporarily tripped up by the a

Re: pygame.Rect question

2012-04-09 Thread Peter Pearson
On Sun, 8 Apr 2012 16:58:01 -0700 (PDT), Scott Siegler wrote: [snip] > I set rect.left to 30, rect.top to 30 and rect.width = 20 > > This works fine. However, when looking at rect.right() it > shows that it is equal to 50. I suppose this is equal to > 30+20. However, since the first pixel is on l

Re: Interrupting a blocking function frolm another thread.

2012-04-09 Thread superhac...@gmail.com
On Apr 8, 8:09 pm, Adam Skutt wrote: > On Apr 8, 5:52 pm, superhac...@gmail.com wrote: > > > > > > > > > > > On Sunday, April 8, 2012 3:55:41 PM UTC-5, Adam Skutt wrote: > > > On Apr 8, 2:45 pm, "superhac...@gmail.com" > > > wrote: > > > > I am using the python module nfqueue-bindings which is a

Re: Question on Python 3 shell restarting

2012-04-09 Thread Miki Tebeka
> How may I get a fresh Python shell with Idle 3.2 ? Open the configuration panel (Options -> Configure IDLE). Look in the "Keys" tab for the shortcut to "restart-shell" HTH -- Miki Tebeka http://pythonwise.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: ast.parse

2012-04-09 Thread Kiuhnm
On 4/9/2012 14:43, Irmen de Jong wrote: On 9-4-2012 13:53, Kiuhnm wrote: Is it a known fact that ast.parse doesn't handle line continuations and some multi-line expressions? For instance, he doesn't like for (x, y) in each([1, 2]): print(1) at all.

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Adam Skutt
On Apr 9, 6:01 am, Janis wrote: > Hello! > > I have this problem with my script exiting randomly with Linux OS > status code -9 (most often) or -15 (also sometimes, but much more > rarely). As far as I understand -9 corresponds to Bad file descriptor > and -15 Block device required. > As Alain al

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Adam Skutt
On Apr 9, 6:47 am, Alain Ketterlin wrote: > Janis writes: > > I have this problem with my script exiting randomly with Linux OS > > status code -9 (most often) or -15 (also sometimes, but much more > > rarely). As far as I understand -9 corresponds to Bad file descriptor > > and -15 Block device

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Emile van Sebille
On 4/9/2012 3:47 AM Alain Ketterlin said... Janis writes: I have this problem with my script exiting randomly with Linux OS status code -9 (most often) or -15 (also sometimes, but much more rarely). My guess is that your script hits a limit, e.g., number of open files, or stack-size, or...

Re: f python?

2012-04-09 Thread Roy Smith
In article <4f82d3e2$1$fuzhry+tra$mr2...@news.patriot.net>, Shmuel (Seymour J.) Metz wrote: > >Null terminated strings have simplified all kids of text > >manipulation, lexical scanning, and data storage/communication > >code resulting in immeasurable savings over the years. > > Yeah, especial

Re: ast.parse

2012-04-09 Thread Irmen de Jong
On 9-4-2012 13:53, Kiuhnm wrote: > Is it a known fact that ast.parse doesn't handle line continuations and some > multi-line > expressions? > For instance, he doesn't like > for (x, > y) in each([1, > 2]): > print(1) > at all. > Is there a workaround besid

Re: f python?

2012-04-09 Thread Seymour J.
In <20120408114313...@kylheku.com>, on 04/08/2012 at 07:14 PM, Kaz Kylheku said: >Null-terminated strings are infinitely better than the ridiculous >encapsulation of length + data. ROTF,LMAO! >For one thing, if s is a non-empty null terminated string then, >cdr(s) is also a string representi

Re: Python Gotcha's?

2012-04-09 Thread Neil Cerutti
On 2012-04-08, John Nagle wrote: > 6. Multiple inheritance is a mess. Especially "super". Python allows you to get dirty. Super solves a messy problem. > 10. Python 3 isn't upward compatible with Python 2. Even minor versions of Python are usually not forward compatible. In the case of 2 to 3

Re: Question on Python 3 shell restarting

2012-04-09 Thread Albert W. Hopkins
On Sun, 2012-04-08 at 20:09 +0200, Franck Ditter wrote: > How may I get a fresh Python shell with Idle 3.2 ? > I have to run the same modules several times with all > variables cleared. Why don't you write your module as a script and pass the variables via command line like most human beings? --

Re: ast.parse

2012-04-09 Thread Chris Rebert
On Mon, Apr 9, 2012 at 4:53 AM, Kiuhnm wrote: > Is it a known fact that ast.parse doesn't handle line continuations and some > multi-line expressions? > For instance, he doesn't like >    for (x, >         y) in each([1, >                     2]): >        print(1) > at all. > Is there a workaroun

ast.parse

2012-04-09 Thread Kiuhnm
Is it a known fact that ast.parse doesn't handle line continuations and some multi-line expressions? For instance, he doesn't like for (x, y) in each([1, 2]): print(1) at all. Is there a workaround besides "repairing" the code on the fly? Kiuhnm -- http:

Re: ordering with duck typing in 3.1

2012-04-09 Thread Neil Cerutti
On 2012-04-07, Jon Clements wrote: > Any reason you can't derive from int instead of object? You may > also want to check out functions.total_ordering on 2.7+ functools.total_ordering I was temporarily tripped up by the aforementioned documentation, myself. -- Neil Cerutti -- http://mail.pyth

Re: How to resolve circular reference in python C extension?

2012-04-09 Thread Yonggang Luo
I means remove the circular references without hurt the code, that is, these two object will be destroyed at the same time. Even there creation time is differ 2012/4/9, Stefan Behnel : > 罗勇刚(Yonggang Luo) , 09.04.2012 04:28: >> static PyObject * >> Repository_get_index(Repository *self, void *clos

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Alain Ketterlin
Janis writes: > I have this problem with my script exiting randomly with Linux OS > status code -9 (most often) or -15 (also sometimes, but much more > rarely). As far as I understand -9 corresponds to Bad file descriptor > and -15 Block device required. How do you get -9 and -15? Exit status is

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Andrew Berg
On 4/9/2012 5:01 AM, Janis wrote: > I have this problem with my script exiting randomly with Linux OS > status code -9 (most often) or -15 (also sometimes, but much more > rarely). As far as I understand -9 corresponds to Bad file descriptor > and -15 Block device required. > > 1) Is there a way h

Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Janis
Hello! I have this problem with my script exiting randomly with Linux OS status code -9 (most often) or -15 (also sometimes, but much more rarely). As far as I understand -9 corresponds to Bad file descriptor and -15 Block device required. 1) Is there a way how I could find out what exactly cause

Re: pygame.Rect question

2012-04-09 Thread Pekka Karjalainen
On Mon, Apr 9, 2012 at 3:29 AM, Dave Angel wrote: > I don't know about pygame, but almost everywhere in the standard > library, ranges are closed at the begin and open at the end.  For > example, if you have range(30, 50), there are 20 items, numbered 30 > through 49.  I expect the same will be tr

Re: How to resolve circular reference in python C extension?

2012-04-09 Thread Stefan Behnel
罗勇刚(Yonggang Luo) , 09.04.2012 04:28: > static PyObject * > Repository_get_index(Repository *self, void *closure) > { > int err; > git_index *index; > Index *py_index; > > assert(self->repo); > > if (self->index == NULL) { > err = git_repository_index(&index, self->rep

Re: f python?

2012-04-09 Thread Andrew Berg
On 4/9/2012 1:52 AM, Chris Angelico wrote: > I think this will be a real winner, and you > should team up with Ranting Rick to produce a new operating system and > Python with this new specification and RULE THE WORLD! But only after going back to the cage to plan for tomorrow night. -- CPython 3

Re: f python?

2012-04-09 Thread Alex Mizrahi
Ok no problem. My sloppiness. After all, my implementation wasn't portable. So, let's fix it. After a while, discovered there's the os.sep. Ok, replace "/" to os.sep, done. Then, bang, all hell went lose. Because, the backslash is used as escape in string, so any regex that manipulate path got fuc