Re: how to prevent the "extended call syntax" (*) from expanding a string into a list of characters

2010-07-22 Thread Ben Finney
fulv writes: > return strategy.create(*args, **kwargs) > TypeError: create() takes exactly 2 non-keyword arguments (150 given) > > Basically, args and kwargs come as the return values from my > overridden function configuration(): > > args, kw = self.configuration() >

Re: Unzip File un Python 5.5

2010-07-22 Thread Steven D'Aprano
On Wed, 21 Jul 2010 23:35:32 -0700, Girish wrote: > Hello All, > > I am using Python 2.5. How do I extract all the files and directories in > a zip file? import zipfile z = zipfile.ZipFile("test.zip", mode="r") for internal_filename in z.namelist(): contents = z.read(internal_filename) o

an error about DJANGO_SETTINGS_MODULE

2010-07-22 Thread aimeixu
Hi, I use python Django framework to make a bookmark website, when I clicked login button on the user login page .and I import "from django.contrib.auth.models import User" in the console,It will occur the following error: >>> from django.contrib.auth.models import User Traceback (most rece

Re: an error about DJANGO_SETTINGS_MODULE

2010-07-22 Thread Chris Rebert
On Thu, Jul 22, 2010 at 1:14 AM, aimeixu wrote: > Hi, > I use python Django framework to make a bookmark website, when I clicked >  login button on  the user login page .and I  import "from > django.contrib.auth.models import User" in the console,It will occur the > following error: from djan

Re: detect endianness of a binary with python

2010-07-22 Thread Daniel Fetchinson
>>> Something like the "file" utility for linux would be very helpfull. >>> >>> Any help is appreciated. > >>You're going to have to describe in detail what's in the file before >>anybody can help. > > We are creating inside our buildsystem for an embedded system a cram > filesystem > image. Later

Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
Hello, I'm referring to http://groups.google.com/group/comp.lang.python/browse_thread/thread/4f9ba9816fe4fd55# I'm currently implementing what looks like a promising solution. I have one problem though. My code generator isn't awfully complex, but still I have problems trying to figure out where

Re: Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
>         # "public final" >         modifierString = "" > >         i = 0 > >         for modifier in method.getModifiers(): >             if i > 0: >                 modifierString += " " >             modifierString += modifier > >             i += 1 > And please don't comment on the code itsel

Convert Unix timestamp to Readable Date/time

2010-07-22 Thread kak...@gmail.com
Well i have the following number 1279796174846 i did the following: mdate = 1279796174846 tempStr = str(mdate) tempStr2 = tempStr[:-3] tempInt = int(tempStr2) print "Last Login :", datetime.datetime.fromtimestamp(tempInt) that prints out: 2010-07-22 06:56:14 But when i check my answer at http://

Re: Convert Unix timestamp to Readable Date/time

2010-07-22 Thread Chris Rebert
On Thu, Jul 22, 2010 at 5:54 AM, kak...@gmail.com wrote: > Well i have the following number 1279796174846 >  i did the following: > > mdate = 1279796174846 > tempStr = str(mdate) > tempStr2 = tempStr[:-3] > tempInt = int(tempStr2) > print "Last Login :", datetime.datetime.fromtimestamp(tempInt) >

Sun Grid Engine / NFS and Python shell execution question

2010-07-22 Thread J.B. Brown
Hello everyone, and thanks for your time to read this. For quite some time, I have had a problem using Python's shell execution facilities in combination with a cluster computer environment (such as Sun Grid Engine (SGE)). In particular, I wish to repeatedly execute a number of commands in sub-she

Re: Sun Grid Engine / NFS and Python shell execution question

2010-07-22 Thread MRAB
J.B. Brown wrote: Hello everyone, and thanks for your time to read this. For quite some time, I have had a problem using Python's shell execution facilities in combination with a cluster computer environment (such as Sun Grid Engine (SGE)). In particular, I wish to repeatedly execute a number of

Re: how to prevent the "extended call syntax" (*) from expanding a string into a list of characters

2010-07-22 Thread fulv
Thank you all! Really appreciate the quick help! -- http://mail.python.org/mailman/listinfo/python-list

Improper Backtraces in Exec'd Code

2010-07-22 Thread Burton Samograd
Hello, I have written an importing extension along the lines of PEP 302 (http://www.python.org/dev/peps/pep-0302/) and have run into a bit of a problem with stack backtraces after exceptions. When I run code with the using my importing extension, backtraces come up looking like this: Traceback (

Re: source install of python2.7 and rpm install of cx_Oracle collision

2010-07-22 Thread Nils Ruettershoff
Hi Jim, Jim Qiu wrote: [...] I find out that only libpython2.7.a generated when I install python2.7, who can tell me what I need to do ? I want a libpython2.7.so.1.0 generated when I've didn't read your complete mail... In addition to the steps I've described in my other mail, you need to

Re: Sorting a list created from a parsed xml message

2010-07-22 Thread Thomas Jollans
On 07/21/2010 03:38 PM, kak...@gmail.com wrote: > On Jul 21, 9:04 am, "kak...@gmail.com" wrote: >> On Jul 21, 8:58 am, Stefan Behnel wrote: >> >> >> >>> kak...@gmail.com, 21.07.2010 14:36: >> From the subject of my message it's clear that i get an xml message from a socket, >> >>> Not a

Re: source install of python2.7 and rpm install of cx_Oracle collision

2010-07-22 Thread Nils Ruettershoff
Hi Jim, Jim Qiu wrote: I make installed python 2.7 from source, and also installed the RPM version of cx_Oracle for python 2.7. But ldd tells me : #ldd cx_Oracle.so libpython2.7.so.1.0 => not found I find out that only libpython2.7.a generated when I install python2.7,

Re: Improper Backtraces in Exec'd Code

2010-07-22 Thread Peter Otten
Burton Samograd wrote: > Hello, > > I have written an importing extension along the lines of PEP 302 > (http://www.python.org/dev/peps/pep-0302/) and have run into a bit of a > problem with stack backtraces after exceptions. > > When I run code with the using my importing extension, backtraces c

Re: Improper Backtraces in Exec'd Code

2010-07-22 Thread Burton Samograd
Peter Otten <__pete...@web.de> writes: > If you make the compilation step explicit you can pass a filename: > exec compile("def f(x): return f(x-1) if x else 1/0", "yadda.py", > "exec") The works great. Problem solved. Thanks. -- Burton Samograd -- http://mail.python.org/mailman/listin

pycrypto rsa string decryption

2010-07-22 Thread joblack
I have an encrypted string and a key string (512 bits long). After studying the pycrypto documentation I still don't get how to read the private key and decrypt the string. - read the 512 bit string as private key - decrypt the encrypted string with rsa Any short code example how to do that? Gre

trace of NANO THERMITE in WTC dust -- and almost no asbestos, because the scare stopped it from being used (and the buildings might not have collapsed, if it was)

2010-07-22 Thread spudnik
I know what Thermite (TM) is, and I didn't even googol it. > Whats the qualification of you a faceless, spky bustard ? unlike > HONORABLE Professor Dr Steven Jones, who sacrificed his job and career > at BYU  - Brigham Young University . Whats your sacrifice to show your > conviction from your

Re: Visitor pattern and separating iteration

2010-07-22 Thread Ian
Hi Karsten, On 22/07/2010 12:03, Karsten Wutzke wrote: What is it I'm missing? I think you are making it more complicated than it really is. The visitor pattern is about bringing all the little bits that would otherwise be scattered all over many node classes into one visitor class. For c

Re: Visitor pattern and separating iteration

2010-07-22 Thread Mark Lawrence
On 22/07/2010 12:03, Karsten Wutzke wrote: Hello, I'm referring to http://groups.google.com/group/comp.lang.python/browse_thread/thread/4f9ba9816fe4fd55# I'm currently implementing what looks like a promising solution. I have one problem though. My code generator isn't awfully complex, but sti

James Gosling the Creator of EMACS and JAVA - leaves ORACLE - But then reports started coming in of odd failures. Systems would crash strangely. We'd get crashes in applications. All applications. C

2010-07-22 Thread small Pox
But then reports started coming in of odd failures. Systems would crash strangely. We'd get crashes in applications. All applications. Crashes in the kernel. But then reports started coming in of odd failures. Systems would crash strangely. We'd get crashes in applications. All applications. Crash

Re: James Gosling the Creator of EMACS and JAVA - leaves ORACLE - But then reports started coming in of odd failures. Systems would crash strangely. We'd get crashes in applications. All applications

2010-07-22 Thread small Pox
On Jul 22, 2:40 pm, small Pox wrote: > But then reports started coming in of odd failures. Systems would > crash strangely. We'd get crashes in applications. All applications. > Crashes in the kernel. > > But then reports started coming in of odd failures. Systems would > crash strangely. We'd get

Re: James Gosling the Creator of EMACS and JAVA - leaves ORACLE - But then reports started coming in of odd failures. Systems would crash strangely. We'd get crashes in applications. All applications

2010-07-22 Thread nanothermite911fbibustards
On Jul 22, 2:40 pm, small Pox wrote: > But then reports started coming in of odd failures. Systems would > crash strangely. We'd get crashes in applications. All applications. > Crashes in the kernel. > > But then reports started coming in of odd failures. Systems would > crash strangely. We'd get

Re: ANN: blist 1.2.0

2010-07-22 Thread Terry Reedy
On 7/21/2010 6:56 PM, Daniel Stutzbach wrote: On Wed, Jul 21, 2010 at 5:27 PM, Terry Reedy mailto:tjre...@udel.edu>> wrote: These tests use random numbers with a constant, relatively high density of 25%, which is favorable to radix sort. What if you do the same test with a constant r

Re: Easy questions from a python beginner

2010-07-22 Thread wheres pythonmonks
Okay -- so I promised that I would try the namespace mangling approach, and here's what I have come up with: Approach #1: Pass in the variables to be swapped as strings. (boring) >>> import sys >>> def swap(n1,n2): ... try: ... raise RuntimeException() ... except: ... e,b,t = sys.exc_info

Re: ANN: blist 1.2.0

2010-07-22 Thread Mark Lawrence
On 22/07/2010 23:25, Terry Reedy wrote: On 7/21/2010 6:56 PM, Daniel Stutzbach wrote: On Wed, Jul 21, 2010 at 5:27 PM, Terry Reedy mailto:tjre...@udel.edu>> wrote: These tests use random numbers with a constant, relatively high density of 25%, which is favorable to radix sort. What if you do th

Re: Sun Grid Engine / NFS and Python shell execution question

2010-07-22 Thread Neil Hodgson
J.B. Brown: > I believe the source of this problem is that os.popen() or os.system() > calls spawn subshells which then reference my shell resource files > (.zshrc, .cshrc, .bashrc, etc.). > But I don't see an alternative to os.popen{234} or os.system(). > os.exec*() cannot solve my problem, becau

Re: ANN: blist 1.2.0

2010-07-22 Thread Daniel Stutzbach
On Thu, Jul 22, 2010 at 5:25 PM, Terry Reedy wrote: > Looks good so far. I would like to see that repeated all the way down to > range(10) to make sure people doing millions of small sorts were not getting > screwed. > I only use the radix sort for n > 40. :-) > Have you run a patched version

Re: urllib2 test fails (2.7, linux)

2010-07-22 Thread guandalino
On 22 Lug, 01:13, Terry Reedy wrote: [cut] > > Any hint? > > Remove the offending fake url. This makes tests to pass, but I have concrete reasons to think that urllib2 is really broken on my system. Btw, a(nother) weird thing is that I wrote a standalone test file based on test_urllib2.py and the

Re: ANN: blist 1.2.0

2010-07-22 Thread Terry Reedy
On 7/22/2010 7:22 PM, Daniel Stutzbach wrote: On Thu, Jul 22, 2010 at 5:25 PM, Terry Reedy That's a good point. It's tempting to add an undocumented parameter to blist.sort that selects the sorting algorithm to use, to make it make it easier to test multiple algorithms. There are probably se

Re: Easy questions from a python beginner

2010-07-22 Thread Stephen Hansen
On 7/22/10 3:34 PM, wheres pythonmonks wrote: > Now, I want to make the above codes more "Pythonic" -- is there a way to: > > 1. Get the function's arguments from the perspective of the caller? > > def f(x): > print "caller's view of x = %s" % callersview(x) > > Then, f(1+2+3) would yield: >

Re: Easy questions from a python beginner

2010-07-22 Thread Carl Banks
On Jul 22, 3:34 pm, wheres pythonmonks wrote: > Okay -- so I promised that I would try the namespace mangling > approach, and here's what I have come up with: > > Approach #1:  Pass in the variables to be swapped as strings.  (boring) > > >>> import sys > >>> def swap(n1,n2): > > ...  try: > ...  

Re: Pydev 1.6.0 Released

2010-07-22 Thread Fabio Zadrozny
> > The supposed feature to start a console in which the contents of the > current editor window are automatically "exec"ed /available still > doesn't work for me. > > I'm talking about this: > http://www.pydev.org/manual_adv_interactive_console.html > > Pressing Ctrl-Alt-Enter, a interactive conso

Brief guide to using virtualenv and wxpython

2010-07-22 Thread batok
This Brief guide to using virtualenv with wxpython , written with sphinx may be helpful for you. If your dev platform is mac os x. The documented process is about python 2.7 , wxpython 2.8.11 and virtualenv. http://bit.ly/bwdWCR -- http://mail.python.org/mailman/listinfo/python-list

Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
Hi Guys, I am very new to python and I am trying to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet of my code: hostsock is the socket object print

Re: Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
Aaah figured it out...!! It was elementary, I was lacking the carriage return and line feed characters at the end of the status and header line. Here is how I solved it: hostsock.send(b'HTTP/1.1 301 Moved Permanently\r\nLocation: http://www.example.com\r\n' ) Regards, Nav On 23-Jul-20

Re: Sending HTTP headers via plain sockets

2010-07-22 Thread MRAB
Navkirat Singh wrote: Aaah figured it out...!! It was elementary, I was lacking the carriage return and line feed characters at the end of the status and header line. Here is how I solved it: hostsock.send(b'HTTP/1.1 301 Moved Permanently\r\nLocation: http://www.example.com\r\n')

Re: Easy questions from a python beginner

2010-07-22 Thread wheres pythonmonks
Thanks for pointing out that swap (and my swap2) don't work everywhere -- is there a way to get it to work inside functions? "No offense, but you seem like you're still tying to be a hacker. If that's what you want, fine, but generally speaking (and particularly for Python), you are going to have

Where is the man page of python library

2010-07-22 Thread march
Hi, guys. As a regular user of python, I am often annoyed by the fact that the official python docementation is too short and too simple to satisfy my requirement. While working with socket, I want to know every detail about every API. I can easilly achieve that by reading man page if the langua

Re: Easy questions from a python beginner

2010-07-22 Thread Steven D'Aprano
On Thu, 22 Jul 2010 18:34:11 -0400, wheres pythonmonks wrote: > Okay -- so I promised that I would try the namespace mangling approach, > and here's what I have come up with: > > Approach #1: Pass in the variables to be swapped as strings. (boring) Boring and slow and stupid. It makes an inter

TOLERANCE IN ISLAM

2010-07-22 Thread nais-saudi
TOLERANCE IN ISLAM http://www.islamhouse.com/s/9661 Tolerance In Islam TOLERANCE IN ISLAM In Spain under the Umayyads and in Baghdad under the Abbasid Khalifas, Christians and Jews, equally with Muslims, were admitted to the Schools and universities - not only that, but were boarded and lodged

Re: Where is the man page of python library

2010-07-22 Thread Steven D'Aprano
On Thu, 22 Jul 2010 20:18:43 -0700, march wrote: > Hi, guys. > > As a regular user of python, I am often annoyed by the fact that the > official python docementation is too short and too simple to satisfy my > requirement. Python is a volunteer effort. If the docs don't suit your requirements,

Re: Easy questions from a python beginner

2010-07-22 Thread Stephen Hansen
On 7/22/10 7:47 PM, wheres pythonmonks wrote: > Thanks for pointing out that swap (and my swap2) don't work everywhere > -- is there a way to get it to work inside functions? > > "No offense, but you seem like you're still tying to be a hacker. If > that's what you want, fine, but generally speak

Re: Where is the man page of python library

2010-07-22 Thread march
Steven, thank you for your reply. It is true that I didn't read the document with enough carefulness. some of my questions are answered in the page I post the link of. Some are not. But the documentation is poor. You need to read throughout the entire page, hoping to find what you need about one

Re: detect endianness of a binary with python

2010-07-22 Thread Tim Roberts
Holger brunck wrote: > >We are creating inside our buildsystem for an embedded system a cram >filesystem >image. Later on inside our build process we have to check the endianness, >because it could be Little Endian or big endian (arm or ppc). > >The output of the "file" tool is for a little endi

Re: ANN: blist 1.2.0

2010-07-22 Thread Daniel Stutzbach
On Thu, Jul 22, 2010 at 6:52 PM, Terry Reedy wrote: > Another sort of issue will be code maintainability. Two algorithms is > potentially more problems than one. To me, that partly depends on how well > factored the current code is. > Two algorithms is more code than one algorithm. No way aroun

Re: Easy questions from a python beginner

2010-07-22 Thread Carl Banks
On Jul 22, 7:47 pm, wheres pythonmonks wrote: > Thanks for pointing out that swap (and my swap2) don't work everywhere > -- is there a way to get it to work inside functions? Impossible without hacking the interpreter. > "No offense, but you seem like you're still tying to be a hacker.  If > th

Change Encoding in Py 2.5

2010-07-22 Thread Girish
Hello, Is ter a way to change default encoding in py 2.5 ? Thanks, Girish.. -- http://mail.python.org/mailman/listinfo/python-list