Re: CSV writer question

2011-10-23 Thread Chris Rebert
On Sun, Oct 23, 2011 at 10:18 PM, Jason Swails wrote: > Hello, > > I have a question about a csv.writer instance.  I have a utility that I want > to write a full CSV file from lots of data, but due to performance (and > memory) considerations, there's no way I can write the data sequentially. > Th

回复: install lxml

2011-10-23 Thread 水静流深
The latest version is lxml 2.3.1, released 2011-09-25, 1.download it 2.extract it ,put it in the /home/user/Python-3.2.2/libxml2-2.7.8 3.cd /home/user/Python-3.2.2/libxml2-2.7.8 4. ./configure 5.make 6.sudo make install when i finished ~$ python3.2 Python 3.2.2 (default, Oct 24 2011, 1

Re: Books to lean Python 3 Web Programming?

2011-10-23 Thread moijes12
On Oct 23, 3:18 am, Jonathan Loescher wrote: > Can anyone recommend a good book to learn the web programming aspects > of Python 3? Hi Try out "Dive into Python 3" for an introduction to HTTP services. regards Moses -- http://mail.python.org/mailman/listinfo/python-list

CSV writer question

2011-10-23 Thread Jason Swails
Hello, I have a question about a csv.writer instance. I have a utility that I want to write a full CSV file from lots of data, but due to performance (and memory) considerations, there's no way I can write the data sequentially. Therefore, I write the data in chunks to temporary files, then combi

Re: install lxml

2011-10-23 Thread Terry Reedy
On 10/24/2011 12:02 AM, 水静流深 wrote: there are two python versions in my computer, python2.7 is the default,python3.2 is the second install. for python2.7 ~$python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more info

回复: getroot() problem

2011-10-23 Thread 水静流深
in my computer,there two os , 1.xp+python32 import lxml.html sfile='http://finance.yahoo.com/q/op?s=A+Options' root=lxml.html.parse(sfile).getroot() it is ok import lxml.html sfile='http://frux.wikispaces.com/' root=lxml.html.parse(sfile).getroot() there is problem Traceback (most recent call

Re: What is wrong with my code?

2011-10-23 Thread apometron
The problem is that it is not reporting any error. The do something and quits silently. No rename action is done and no error. Running Python 2.7 on Windows Seven. I know that it is a bit tricky to help someone so, but I dont have any info to pass that be good to understand the situation. Th

install lxml

2011-10-23 Thread 水静流深
there are two python versions in my computer, python2.7 is the default,python3.2 is the second install. for python2.7 ~$python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import lxml >>

Re: What is wrong with my code?

2011-10-23 Thread Chris Rebert
On Sun, Oct 23, 2011 at 8:21 PM, apometron wrote: > Sorry to continue discussing my thread on this list, I already subbed on the > Tutor list > but I need to reply and if possible, some ideas of why it dont works. Now it > is another > thing, entirely. Rename1.py and Rename2.py works, but why Rena

Re: How to use shell return value like $? In python?

2011-10-23 Thread Nick Dokos
David Riley wrote: > On Oct 23, 2011, at 10:44 PM, aaabb...@hotmail.com wrote: > > > exp: > > os.system('ls -al') > > #I like to catch return value after this command. 0 or 1,2,3 > > does python support to get "$?"? > > then I can use something like: > > If $?==0: > > > > ..

Re: What is wrong with my code?

2011-10-23 Thread apometron
Sorry to continue discussing my thread on this list, I already subbed on the Tutor list but I need to reply and if possible, some ideas of why it dont works. Now it is another thing, entirely. Rename1.py and Rename2.py works, but why Rename3.py dont works? http://pastebin.com/dExFtTkp Thanks

Re: How to use shell return value like $? In python?

2011-10-23 Thread David Riley
On Oct 23, 2011, at 10:44 PM, aaabb...@hotmail.com wrote: > exp: > os.system('ls -al') > #I like to catch return value after this command. 0 or 1,2,3 > does python support to get "$?"? > then I can use something like: > If $?==0: > > From the manual (http://docs.

Re: How to use shell return value like $? In python?

2011-10-23 Thread Chris Rebert
On Sun, Oct 23, 2011 at 7:51 PM, wrote: > On Oct 23, 7:44 pm, aaabb...@hotmail.com wrote: >> exp: >> os.system('ls -al') >> #I like to catch return value after this command. 0 or 1,2,3 >> does python support to get "$?"? >> then I can use something like: >>  If $?==0: > So for what I do is:

Re: How to use shell return value like $? In python?

2011-10-23 Thread aaabbb16
On Oct 23, 7:44 pm, aaabb...@hotmail.com wrote: > exp: > os.system('ls -al') > #I like to catch return value after this command. 0 or 1,2,3 > does python support to get "$?"? > then I can use something like: >  If $?==0: >       > > TIA > david So for what I do is: r_n

How to use shell return value like $? In python?

2011-10-23 Thread aaabbb16
exp: os.system('ls -al') #I like to catch return value after this command. 0 or 1,2,3 does python support to get "$?"? then I can use something like: If $?==0: TIA david -- http://mail.python.org/mailman/listinfo/python-list

Re: compare range objects

2011-10-23 Thread 88888 Dihedral
To compare two instances of objects defined by others in the same class or in derived classes from the same base class is an old problem in OOP. -- http://mail.python.org/mailman/listinfo/python-list

Re: getroot() problem

2011-10-23 Thread Dave Angel
On 10/23/2011 09:06 PM, wrote: C:\Documents and Settings\peng>cd c:\python32 C:\Python32>python Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. import lxml.html sfile='ht

getroot() problem

2011-10-23 Thread 水静流深
C:\Documents and Settings\peng>cd c:\python32 C:\Python32>python Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import lxml.html >>> sfile='http://finance.yahoo.com/q/op?s

Re: logging: warn() methods and function to be deprecated.

2011-10-23 Thread Mark Hammond
On 22/10/2011 11:09 PM, Vinay Sajip wrote: In response to an issue (#13235) raised on the Python bug tracker, I'm going to deprecate the warn() methods in the Logger and LoggerAdapter classes in the stdlib logging package, as well the module-level warn() function. The warn() variants were synony

Re: What is wrong with my code?

2011-10-23 Thread Dave Angel
On 10/23/2011 06:03 AM, apometron wrote: import os nome = sys.argv[1] final = nome for i in nome: print i if nome[i] = "_": final[i] = " " os.rename(nome, final) What do you want to be wrong with it? There are so many things, it'd be fun to try to see who could come up with the

Re: Exception Handling (C - extending python)

2011-10-23 Thread Lee
For a moment, back to the basics... I am using the example provided by docs at 2.1.2 "Providing finer control...". Using say: mynoddy = noddy2.Noddy() mynoddy.first = "a" mynoddy.last = 0 the last line causes an ugly crash (on python 2.6.5 on winxp). No way to catch the exception. As I understa

Re: 回复: python32 to write file

2011-10-23 Thread Terry Reedy
On 10/23/2011 9:59 AM, 水静流深 wrote: i change my code into : Calling your file xml.py (as indicated below) is a potentially bad idea since the Python stdlib has a package named 'xml'. If you write 'import xml.xxx' in another file in the same directory, Python will try to find 'xxx' in your xml

Re: Job Offer: 3 Python Backend Developer and other Positions in Berlin

2011-10-23 Thread Waldek M.
On Sun, 23 Oct 2011 17:50:54 +0200, webcrowd.net wrote: > hope it is okay to post job offers here. If not sorry for the spam and > please let me know! Not really. It's a newsgroup on Python *language*, not on Python-everything. You might want to post here instead, though: http://www.python.org/c

Re: File Association for Python on XP

2011-10-23 Thread W. eWatson
On 10/23/2011 9:41 AM, MRAB wrote: To show the extensions, in an Explorer window go to Tools->Folder Options... and look in the View tab. You can also look at the file associations in the File Types tab. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: What is wrong with my code?

2011-10-23 Thread Gary Herron
On 10/23/2011 03:08 AM, Chris Rebert wrote: On Sun, Oct 23, 2011 at 3:03 AM, apometron wrote: import os nome = sys.argv[1] You did not `import sys`, so you'll get a NameError there. final = nome for i in nome: print i if nome[i] = "_": final[i] = " " Strings aren't mutable

Re: File Association for Python on XP

2011-10-23 Thread MRAB
On 23/10/2011 15:57, W. eWatson wrote: Last night I thought I'd install Python on a friend's XP PC. I noticed he had declined to show extensions on any file. I thought the Control Panel might be the way to do it. I couldn't find anything that would do all files, doc, txt, py, etc. I was able to

Re: help

2011-10-23 Thread David Riley
"Libel" and "slander" also generally indicate malice. Perhaps just "That's incorrect" might have come off a little less harsh. :-) - Dave On Oct 23, 2011, at 12:05 PM, Matej Cepl wrote: > Dne 22.10.2011 17:02, Steven D'Aprano napsal(a): >> Rather than assume malice, we should give X1 the ben

Re: help

2011-10-23 Thread Matej Cepl
Dne 22.10.2011 17:02, Steven D'Aprano napsal(a): Rather than assume malice, we should give X1 the benefit of the doubt and assume he genuinely believed what he wrote but was merely mistaken. Sure, I didn't want to assume malice (sorry, English is my second language and sometimes it shows; woul

Job Offer: 3 Python Backend Developer and other Positions in Berlin

2011-10-23 Thread webcrowd.net
Hi Folks, hope it is okay to post job offers here. If not sorry for the spam and please let me know! One of our clients is looking for new and talented people to join their international, seven people strong, developers team in the heart of Berlin. You will join an awesome, nice and humble s

File Association for Python on XP

2011-10-23 Thread W. eWatson
Last night I thought I'd install Python on a friend's XP PC. I noticed he had declined to show extensions on any file. I thought the Control Panel might be the way to do it. I couldn't find anything that would do all files, doc, txt, py, etc. I was able to do it, I think, from a right-click on

回复: python32 to write file

2011-10-23 Thread 水静流深
i change my code into : import urllib.request, urllib.parse, urllib.error import lxml.html down='http://frux.wikispaces.com/' root=urllib.request.urlopen(down).read() root=lxml.html.fromstring(root) file=root.xpath('//a') for i in file: str1=i.text_content() if str1.find('pdf') >-1 :

Re: python32 to write file

2011-10-23 Thread Chris Rebert
2011/10/23 水静流深 <1248283...@qq.com>: >     book=open('c:\'+str1,'w')  #  i  change it > when i run it  in  python32,the output is  : > book=open('c:\'+str1,'w') > invalid  syntax,what is wrong? Your problem is not at all Python 3-specific. Backslashes are used for escape sequences in string l

python32 to write file

2011-10-23 Thread 水静流深
code 1 can run in python2.6 #coding:utf-8 import urllib import lxml.html down='http://frux.wikispaces.com/' root=urllib.urlopen(down).read() root=lxml.html.fromstring(root) file=root.xpath('//a') for i in file: str1=i.text_content() if str1.find('pdf') >-1 : str2='http://frux.wi

Re: Exception Handling (C - extending python)

2011-10-23 Thread Stefan Behnel
Hi, note that I reformatted your posting to get the replies back into order. Lee, 23.10.2011 13:32: On Oct 23, 10:06 pm, Stefan Behnel wrote: Lee, 23.10.2011 06:09: Where does PyExc_TypeError (and alike) points to? I can see its declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerr

Re: Exception Handling (C - extending python)

2011-10-23 Thread Christian Heimes
Am 23.10.2011 06:09, schrieb Lee: > Hi all, > > Where does PyExc_TypeError (and alike) points to? I can see its > declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h > but I cannot figure out what it is its value, where it is > initialized. It's initialized in Objects/exceptions

Re: Exception Handling (C - extending python)

2011-10-23 Thread Lee
Thanks Stefan, I am just interested to understand the mechanism inside python. If it points to an object that means I can defered it (through ob_type). >From there, how a function like PyErr_SetString knows what exception is? Where its value is kept? Lee On Oct 23, 10:06 pm, Stefan Behnel wro

Deditor 0.3.1

2011-10-23 Thread Kruptein
Hey, I'm happy to announce a new release of Deditor version 0.3.1. What is Deditor? Deditor is a pythonic text-editor, written 100% in python and with the primary goal to ease python development. There is a python shell, codecompletion, code analyzing, instant code running and error checking and

Re: How to isolate a constant?

2011-10-23 Thread Paul Rudin
Gnarlodious writes: > Thanks for all those explanations, I've already fixed it with a tuple. > Which is more reliable anyway. neither of lists or tuples are "more reliable" than the other. They both have perfectly well defined behaviour (which can be gleaned from reading the documentation) and r

Re: What is wrong with my code?

2011-10-23 Thread Chris Rebert
On Sun, Oct 23, 2011 at 3:03 AM, apometron wrote: > import os > nome = sys.argv[1] You did not `import sys`, so you'll get a NameError there. > final = nome > for i in nome: >    print i >    if nome[i] = "_": >        final[i] = " " Strings aren't mutable in Python; you can't assign to slices

What is wrong with my code?

2011-10-23 Thread apometron
import os nome = sys.argv[1] final = nome for i in nome: print i if nome[i] = "_": final[i] = " " os.rename(nome, final) -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception Handling (C - extending python)

2011-10-23 Thread Stefan Behnel
Lee, 23.10.2011 06:09: Where does PyExc_TypeError (and alike) points to? I can see its declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h but I cannot figure out what it is its value, where it is initialized. It gets initialised inside of the interpreter core and then points