Re: Passing string from python programs to external programs

2009-05-26 Thread Jeff McNeil
On May 26, 2:12 pm, lone_eagle wrote: > Hi all, > > On Linux, I do something like this > > $ program_to_execute < input_file > ... get some output ... > > I have the content of the input_file as a string inside a python > program and would like to pass this string to the external program > from in

Re: download all mib files from a web page

2009-05-27 Thread Jeff McNeil
On May 27, 12:29 pm, powah wrote: > I want to download all mib files from the web > page:http://www.juniper.net/techpubs/software/junos/junos94/swconfig-net-m... > > All mib filenames are of this format:www.juniper.net/techpubs... .txt > > I write this program but has the following error. > Pleas

Re: how to change response code in CGIHTTPServer.py

2009-05-29 Thread Jeff McNeil
On May 28, 2:23 pm, Daniel wrote: > Hello, > > Python 2.5.2 > WinXP > > I'm using CGIHTTPServer.py and want to return a response code of 400 > with a message in the event that the cgi script fails for some > reason.  I notice that > run_cgi(self): > executes this line of code, > self.send_response

Re: Unable to write output from os.path.walk to a file.

2008-06-04 Thread Jeff McNeil
What exactly are you trying to accomplish? If you're just looking for the contents of a directory, it would be much easier to simply call os.listdir(dirinput) as that will return a list of strings that represent the entries in dirinput. As it stands, 'os.path.walk' will return None in your example

Re: Unable to write output from os.path.walk to a file.

2008-06-04 Thread Jeff McNeil
r your reply. I would like to like the absolute path of a > directory. I thought that os.listdir just returns the nam itself in a data > list. > > I noticed that none was being return in my example. Do you think that I have > the arguments misplaced? > > Thanks, > Paul

Re: How to send a POST request?

2008-06-06 Thread Jeff McNeil
The original urllib module will do it too, if you pass a data keyword argument to urllib.urlopen: u = urllib.urlopen('http://www.domain.com/cgi-bin/cgi.py', data=urllib.urlencode({'name': 'pythonguy'})) On Fri, Jun 6, 2008 at 6:04 PM, kj <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]> kj <[E

Re: Programming question

2008-06-11 Thread Jeff McNeil
Have a look at os.listdir and os.stat. I've never worked with 1.5, so I don't know what will work with it and what won't,. but I'd imagine the following ought to be fine, though. stat_list = [] for dirent in os.listdir('your_directory'): stat_list.append(os.stat(dirent)) Jeff On Wed, Jun

Re: urllib (54, 'Connection reset by peer') error

2008-06-13 Thread Jeff McNeil
It means your client received a TCP segment with the reset bit sent. The 'peer' will toss one your way if it determines that a connection is no longer valid or if it receives a bad sequence number. If I had to hazard a guess, I'd say it's probably a network device on the server side trying to stop

Re: Making HEAD/PUT/DELETE requests with urllib2?

2008-06-13 Thread Jeff McNeil
The only time I've ever pulled a HEAD request I've used the httplib module directly. Ought to be able to do it like so: Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import h

Re: Socket Programming

2008-06-14 Thread Jeff McNeil
On Jun 14, 5:38 pm, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > Is there any way(method) to find whether the socket got closed or not?? > Thanks, > Srini > >       Best Jokes, Best Friends, Best Food and more. Go > tohttp://in.promos.yahoo.com/groups/bestofyahoo/ That's slightly diffi

Re: Looking for lots of words in lots of files

2008-06-18 Thread Jeff McNeil
On Jun 18, 10:29 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > brad wrote: > > Just wondering if anyone has ever solved this efficiently... not looking > > for specific solutions tho... just ideas. > > > I have one thousand words and one thousand files. I need to read the > > files to see if

Re: Sending information to a website

2008-06-24 Thread Jeff McNeil
On Jun 24, 12:13 am, Alex Bryan <[EMAIL PROTECTED]> wrote: > Okay, so what I want to do is connect to dictionary.com and send the > website a word, and later receive the definition. But for now, I want > to focus on sending the word. A good guy from this mailing list said I > should look into the c

Re: using urllib2

2008-06-27 Thread Jeff McNeil
I stumbled across this a while back: http://www.voidspace.org.uk/python/articles/urllib2.shtml. It covers quite a bit. The urllib2 module is pretty straightforward once you've used it a few times. Some of the class naming and whatnot takes a bit of getting used to (I found that to be the most con

Re: using urllib2

2008-06-29 Thread Jeff McNeil
thing. But I want to know why you put "for tabs," also why you > need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces and > whatnot? > > Jeff McNeil-2 wrote: > > > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTE

Re: using urllib2

2008-06-29 Thread Jeff McNeil
then the one for > >> simple, and the code I am using to do the work. > > >> line of html for the 2nd def of cheese: > > >> 2. >> valign="top">a definite mass of this substance, often in the shape of a > >> wheel or cylinder. > > &

Re: Looking for File comparison utility that produces actual differences

2008-09-03 Thread Jeff McNeil
On Sep 3, 2:40 pm, [EMAIL PROTECTED] wrote: > Hi, > > I looking for a file comparison utility in Python that works like > 'diff' command in Unix and 'comp' in Windows. > The present 'cmd' in filecmp module only presents output in the form > of 1 or 0 i.e whether the 2 files differ or not? > > So,

Re: What does the list_folders() method of mailbox.Maildir actually do (if anything)?

2009-09-25 Thread Jeff McNeil
On Sep 25, 3:22 pm, tinn...@isbd.co.uk wrote: > I can't get the list_folders() method of the mailbox.Maildir class to > do anything remotely useful.  It seems to do nothing at all.  I have a > directory which contains a number of maildir malboxes:- > >     chris$ ls -l /home/chris/Mail/apex >     t

Re: What does the list_folders() method of mailbox.Maildir actually ?do (if anything)?

2009-09-25 Thread Jeff McNeil
On Sep 25, 4:13 pm, tinn...@isbd.co.uk wrote: > Jeff McNeil wrote: > > On Sep 25, 3:22 pm, tinn...@isbd.co.uk wrote: > > > I can't get the list_folders() method of the mailbox.Maildir class to > > > do anything remotely useful.  It seems to do nothing at all.

Re: What does the list_folders() method of mailbox.Maildir actually ?do (if anything)?

2009-09-25 Thread Jeff McNeil
On Sep 25, 4:28 pm, Jeff McNeil wrote: > On Sep 25, 4:13 pm, tinn...@isbd.co.uk wrote: > > > > > > > Jeff McNeil wrote: > > > On Sep 25, 3:22 pm, tinn...@isbd.co.uk wrote: > > > > I can't get the list_folders() method of the mailbox.Maildir class

Re: directory wildcard

2009-11-16 Thread Jeff McNeil
On Nov 16, 3:33 pm, hong zhang wrote: > List, > > I try to assign value to force_mcs sitting in a wildcard subdirectory > /sys/kernel/debug/ieee80211/phy*, but python does not work for that such as: > > os.system("echo %i > /sys/kernel/debug/ieee80211/phy*/iwlagn/data/force_mcs" > % mcs) > > Any

Re: CentOS 5.3 vs. Python 2.5

2009-11-25 Thread Jeff McNeil
On Nov 25, 4:45 am, Jon Clements wrote: > On Nov 25, 8:13 am, Steven D'Aprano > > > > > > wrote: > > On Tue, 24 Nov 2009 22:42:28 -0800, John Nagle wrote: > > > My dedicated hosting provider wants to switch me to a new server with > > > CentOS 5.3, so I have to look at how much work is required.

Re: Question about Python upgrade on linux

2010-07-15 Thread Jeff McNeil
On Jul 15, 11:54 am, guandalino wrote: > Hi, suppose I have python 2.6.4 installed from source and I want to > upgrade to 2.6.5. Python standard library is automatically upgraded at > 2.6.5 as well, while 3rd party pure Python and extension modules in > site-packages don't. Is it safe to keep the

Re: Get the class name

2009-06-08 Thread Jeff McNeil
On Jun 8, 11:33 am, Gary Herron wrote: > Kless wrote: > > Is there any way of to get the class name to avoid to have that write > > it? > > > --- > > class Foo: > >    super(Foo, self) > > --- > > > * Using Py 2.6.2 > > The question does not make sense: >     "to have WHAT

Re: MD5 hash of object

2009-06-08 Thread Jeff McNeil
On Jun 8, 3:47 pm, Chris Rebert wrote: > On Mon, Jun 8, 2009 at 11:43 AM, lczancanella wrote: > > Hi, > > > in hashlib the hash methods have as parameters just string, i want to > > know how can i digest an object to get a md5 hash of them. > > Hashes are only defined to operate on bytestrings. Si

Re: What is the actual type of "interrupted system call"?

2009-06-09 Thread Jeff McNeil
On Jun 9, 2:22 pm, mrstevegross wrote: > I'm trying to write a try/catch block to handle an "interrupted system > call". However, I can't seem to locate information on the actual > typename of the exception. Does anyone know what it would be? I want > my code to look like this: > > try: >   ... >

Re: Printing dictionary values rather than references

2009-06-10 Thread Jeff McNeil
On Jun 10, 10:19 am, Amit Dor-Shifer wrote: > Hi all. > > I'd like to print-out a dictionary of objects. The printed values are > references. How Do I print the actual objects. > > class MyClass: >     def __str__(self): >         return str(self.__dict__) > > if __name__ == '__main__': >     dict

Re: Connection tester

2009-06-10 Thread Jeff McNeil
On Jun 10, 10:26 am, Sparky wrote: > Hey! I am developing a small application that tests multiple websites > and compares their "response time". Some of these sites do not respond > to a ping and, for the measurement to be standardized, all sites must > have the same action preformed upon them. An

Re: reading from file

2009-06-11 Thread Jeff McNeil
On Jun 11, 4:24 pm, Sydoruk Yaroslav wrote: > Hello all, > > In a text file aword.txt, there is a string: >     "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". > > There is a first script: > f = open ("aword.txt", "r") > for line in f: >     print chardet.detect(line) >     b = line.decode('c

Re: Question about None

2009-06-12 Thread Jeff McNeil
On Jun 12, 10:05 am, Paul LaFollette wrote: > Kind people, > > Using Python 3.0 on a Gatesware machine (XP). > I am building a class in which I want to constrain the types that can > be stored in various instance variables.  For instance, I want to be > certain that self.loc contains an int.  This

Re: Funny xmlrpc / linux problem

2009-06-16 Thread Jeff McNeil
On Jun 16, 12:51 pm, Hans Müller wrote: > Richard, > > thanks a lot for your hint, that was completely new for me. > Nagle's optimisation is definitely a good idea in most cases. > > By the way, do you have an idea how to access the underlying socket to modify > the behavier > via the setsockopt

Re: I look for private Python Index server on my local network... What do you use ?

2009-06-23 Thread Jeff McNeil
On Jun 23, 7:47 am, Klein Stéphane wrote: > Hi, > > I wonder what Python Index server (like as pypi.python.org) do you use in > your corporation for handle your private python eggs ? > > I found three solutions : > > *http://pypi.python.org/pypi/basketweaver/0.1.2-r6 > *http://pypi.python.org/pypi

Re: How to find info about python 3.x extension module availability?

2009-06-23 Thread Jeff McNeil
On Jun 23, 6:59 am, Francesco Bochicchio wrote: > Hi all, > > is there any site that reports the current porting (to Python 3.x) > status of the main non-standard extension modules (such as pygtk, > pywin32, wxpython, ...) ? > I think such information would be very useful for people - like me - >

Re: Granularity of OSError

2009-09-18 Thread Jeff McNeil
On Sep 18, 3:05 pm, Sean DiZazzo wrote: > On Sep 18, 11:54 am, kj wrote: > > > > > > > I've often come across the idea that good Python style deals with > > potential errors using an EAFP ("easier to ask forgiveness than > > permission") strategy rather than a LBYL ("look before you leap") > > st

Re: Unable to import package over NFS in solaris

2009-09-23 Thread Jeff McNeil
On Sep 23, 12:15 pm, Ashok wrote: > Hi, > > I have sqlalchemy package installed on the server. However I want to > run a script on the client that uses the sqlalchemy package. Hence I > shared the directory containing the sqlalchemy unsing NFS. Then I > added the NFS pathname to the sqlalchemy pac

Re: Getting return code for a Python script invoked from a Linux shell script

2009-09-23 Thread Jeff McNeil
On Sep 23, 12:51 pm, volcano wrote: > Hi, folks, > I have a Python script that is invoked by a shell script. I uses > sys.exit() with a parameter within python. > > The calling script is using this line to get the return code: > exit_code = !$ > > but it fails to get it. What's wrong here? (I am n

Re: Get error message from FTPLib

2009-09-23 Thread Jeff McNeil
On Sep 23, 1:46 pm, Bakes wrote: > I am using ftplib for a project, using a try/except loop. > > I would like to find out the exception, but I am a python newbie and > do not know how. > > How, in a try/except loop would I find the ftplib exception? For a bit on exception handling in general, ch

Re: Good libraries for network programming (not asynchronous)

2009-09-23 Thread Jeff McNeil
On Sep 23, 8:29 pm, Tvrtko wrote: > Hello, > > Is there any good alternative to twisted for network programming which > doesn't involve asynchronous programming? I don't really like the > asynchronous model because it is hard to incorporate all other > blocking libraries that I have to use. And th

<    1   2