Re: Directory Caching, suggestions and comments?

2014-05-15 Thread Cameron Simpson
On 15May2014 15:34, Benjamin Schollnick wrote: I am going to be using this code as part of a web system, and I would love any feedback, comments and criticism. [...] I am using scandir from benhoyt to speed up the directory listings, and data collection. [...] I had considered using OrderedDicts

Re: Directory Caching, suggestions and comments?

2014-05-15 Thread Chris Angelico
On Fri, May 16, 2014 at 5:34 AM, Benjamin Schollnick wrote: > Just as a side note, I'm not completely PEP 8. I know that, I use a > slightly laxer setting in pylint, but I'm working my way up to it... > > I am using scandir from benhoyt to speed up the directory listings, and data > collection.

Re: Directory Web Site

2013-09-23 Thread Chris Angelico
On Mon, Sep 23, 2013 at 11:14 AM, wrote: > Was hoping to get some tips or advice on scripting a program that would sort > through my many links on my directory website and print out to me the ones > that are broken or no longer functioning so that I could fix or remove them > from the site. An

Re: Directory Web Site

2013-09-22 Thread worthingtonclinton
On Sunday, September 22, 2013 9:59:14 PM UTC-4, Dave Angel wrote: > On 22/9/2013 21:14, worthingtonclin...@gmail.com wrote: > > > > > Was hoping to get some tips or advice on scripting a program that would > > sort through my many links on my directory website and print out to me the > > ones

Re: Directory Web Site

2013-09-22 Thread worthingtonclinton
On Sunday, September 22, 2013 9:36:25 PM UTC-4, Joel Goldstick wrote: > On Sun, Sep 22, 2013 at 9:14 PM, wrote: > > Was hoping to get some tips or advice on scripting a program that would sort > through my many links on my directory website and print out to me the ones > that are broken or no

Re: Directory Web Site

2013-09-22 Thread Dave Angel
On 22/9/2013 21:14, worthingtonclin...@gmail.com wrote: > Was hoping to get some tips or advice on scripting a program that would sort > through my many links on my directory website and print out to me the ones > that are broken or no longer functioning so that I could fix or remove them > fro

Re: Directory Web Site

2013-09-22 Thread Joel Goldstick
On Sun, Sep 22, 2013 at 9:14 PM, wrote: > Was hoping to get some tips or advice on scripting a program that would > sort through my many links on my directory website and print out to me the > ones that are broken or no longer functioning so that I could fix or remove > them from the site. Any he

Re: directory wildcard

2009-11-17 Thread Nobody
On Mon, 16 Nov 2009 14:19:16 -0800, hong zhang wrote: >>         print >>f, mcs > > This assigns decimal value, how can I assign Hex here to mcs? print >>f, "%x" % mcs -- http://mail.python.org/mailman/listinfo/python-list

Re: directory wildcard

2009-11-16 Thread hong zhang
--- On Mon, 11/16/09, Jeff McNeil wrote: > From: Jeff McNeil > Subject: Re: directory wildcard > To: python-list@python.org > Date: Monday, November 16, 2009, 3:01 PM > On Nov 16, 3:33 pm, hong zhang > > wrote: > > List, > > > > I try to assign val

Re: directory wildcard

2009-11-16 Thread Tim Chase
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 right way to do it? I'm not sure your code works if there's

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: directory wildcard

2009-11-16 Thread Diez B. Roggisch
hong zhang schrieb: 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 right way to do it? Don't use

Re: Directory

2009-02-18 Thread gtillmon
On Feb 18, 8:15 am, Steve Holden wrote: > gtillmon wrote: > > Hello.  I am new to the Python language. > > I would like to know how to display and store the path of each mondule > > that is called. > > Modules are imported, not called. > > > Similar to the old READY TRACE in COBOL of long ago. > >

Re: Directory

2009-02-18 Thread gtillmon
On Feb 18, 3:39 pm, "Gabriel Genellina" wrote: > En Wed, 18 Feb 2009 12:15:25 -0200, Steve Holden   > escribió: > > > gtillmon wrote: > >> I would like to know how to display and store the path of each mondule > >> that is called. > > It's certainly possible to trace function calls, if that would

Re: Directory

2009-02-18 Thread Gabriel Genellina
En Wed, 18 Feb 2009 12:15:25 -0200, Steve Holden escribió: gtillmon wrote: I would like to know how to display and store the path of each mondule that is called. It's certainly possible to trace function calls, if that would help. sys.settrace allows you to establish a function that gets ca

Re: Directory

2009-02-18 Thread Steve Holden
gtillmon wrote: > Hello. I am new to the Python language. > I would like to know how to display and store the path of each mondule > that is called. Modules are imported, not called. > Similar to the old READY TRACE in COBOL of long ago. > It's certainly possible to trace function calls, if tha

Re: Directory creation

2008-09-07 Thread Fredrik Lundh
srinivasan srinivas wrote: Can someone tell me is there any module available to create directories?? I tried os, tempfile. I was facing some issues with os.mkdir(). The mode setting was not proper with this method. I created the directory 'stdin' with '0700' mode using os.mkdir() method. $>

Re: Directory

2007-08-02 Thread Larry Bates
Rohan wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding this. > import os listofdirs=[d for d i

Re: Directory

2007-07-31 Thread brad
Rohan wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding this. How far down do you want to go? A

Re: Directory

2007-07-31 Thread markacy
On 30 Lip, 23:43, Rohan <[EMAIL PROTECTED]> wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding thi

Re: Directory

2007-07-30 Thread Irmen de Jong
Rohan wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding this. > Look up os.walk (allows you to

Re: "Directory this source file is in (and a sibling)"

2006-09-22 Thread John Machin
Sion Arrowsmith wrote: > I have a module which needs to know what directory it's in, and to > refer to files in a sibling directory, something like App/src/foo.py > wants to read App/data/conf.xml . But I have no idea in what context > foo.py is going to be run -- it could be being run as a script

Re: directory listing

2005-11-12 Thread Shi Mu
thanks a lot! On 11/11/05, Michael Konrad <[EMAIL PROTECTED]> wrote: > > This is what I decided on for a solution. I haven't tested it > cross-platform yet. > > import os > > def dirListing(directory='/Users/mkonrad'): >"""Returns a list of directories.""" >#variabl

Re: directory listing

2005-11-12 Thread [EMAIL PROTECTED]
Shi Mu: Before all you were doing was defining a function with: import os def buildList( directory='c:\TEMP' ): dirs = [ ] listing = os.listdir(directory) for x in listing: x = os.path.join(directory, x) print x if os.path.isdir(x): dirs.append(x)

Re: directory listing

2005-11-11 Thread Michael Konrad
Sorry about that, I guess send was working. Michael Konrad wrote: > > This is what I decided on for a solution. I haven't tested it > cross-platform yet. > > import os > > def dirListing(directory='/Users/mkonrad'): > """Returns a list of directories.""" > #variables > d

Re: directory listing

2005-11-11 Thread Michael Konrad
This is what I decided on for a solution. I haven't tested it cross-platform yet. import os def dirListing(directory='/Users/mkonrad'): """Returns a list of directories.""" #variables dirs = [] #list of directories

Re: directory listing

2005-11-11 Thread Michael Konrad
This is what I decided on for a solution. I haven't tested it cross-platform yet. import os def dirListing(directory='/Users/mkonrad'): """Returns a list of directories.""" #variables dirs = [] #list of directories

Re: directory listing

2005-11-11 Thread Peter Hansen
Shi Mu wrote: > On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >>Shi Mu wrote: >>>def buildList( directory='c:\TEMP' ): >>>dirs = [ ] >>>listing = os.listdir(directory) >>>for x in listing: >>>x = os.path.join(directory, x) >>>print x >>>if os.path.isdir(x

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"Shi Mu" wrote: > print buildList() gets lots of stuffs from my temp directory(there do > exist lots of files). > But why "print x' has nothing? C:\>more script.py import os def buildList( directory='c:\TEMP' ): dirs = [ ] listing = os.listdir(directory) for x in listing: x =

Re: directory listing

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "Shi Mu" wrote: > > > but i am curious why the line of "print x" does not show > > anything. > > because your c:\temp directory is empty ? > > print buildList() gets lots of stuffs from my temp directory(there do exist lots of files). But why

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"Shi Mu" wrote: > but i am curious why the line of "print x" does not show > anything. because your c:\temp directory is empty ? -- http://mail.python.org/mailman/listinfo/python-list

Re: directory listing

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > > I tried this and no error reported but nothing appear on the console, why? > > > > import os > > > > def buildList( directory='c:\TEMP' ): > > dirs = [ ] > > listing = os.listdir(directory) > > for x in listing:

Re: directory listing

2005-11-11 Thread Fredrik Lundh
Shi Mu wrote: > I tried this and no error reported but nothing appear on the console, why? > > import os > > def buildList( directory='c:\TEMP' ): > dirs = [ ] > listing = os.listdir(directory) > for x in listing: > x = os.path.join(directory, x) > print x > if

Re: directory listing

2005-11-11 Thread Shi Mu
On 11 Nov 2005 22:00:04 GMT, Michael Konrad <[EMAIL PROTECTED]> wrote: > Richard Townsend <[EMAIL PROTECTED]> wrote: > > > On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: > > > > Try passing the full pathname of each item to os.path.isdir() > > > > You can create the pathname using os.path.join(

Re: directory listing

2005-11-11 Thread Fredrik Lundh
Michael Konrad wrote: > > for x in listing: > > print x > > if os.path.isdir(x): > > dirs.append(x) > > > > Did that and I was just getting a bunch of [ ]. if you printed "x" (the filename), that doesn't sound very likely. maybe you printed some other variable? (l

Re: directory listing

2005-11-11 Thread Richard Townsend
On 11 Nov 2005 22:00:04 GMT, Michael Konrad wrote: > Richard Townsend <[EMAIL PROTECTED]> wrote: > >> On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: >> >> Try passing the full pathname of each item to os.path.isdir() >> >> You can create the pathname using os.path.join(directory, x) >> >>

Re: directory listing

2005-11-11 Thread Michael Konrad
Richard Townsend <[EMAIL PROTECTED]> wrote: > On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: > > Try passing the full pathname of each item to os.path.isdir() > > You can create the pathname using os.path.join(directory, x) > > > I wonder if I can join ./, so I don't have the full path

Re: directory listing

2005-11-11 Thread Michael Konrad
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > "SU News Server" <[EMAIL PROTECTED]> wrote: > >> I've struggled with this for quite a while and I'm am just not sure >> what is going on. I have the following code >> import os >> >> def buildList( directory='/Users/mkonrad' ) >> >> dirs = [ ] >> >> l

Re: directory listing

2005-11-11 Thread Richard Townsend
On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: Try passing the full pathname of each item to os.path.isdir() You can create the pathname using os.path.join(directory, x) -- Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"SU News Server" <[EMAIL PROTECTED]> wrote: > I've struggled with this for quite a while and I'm am just not sure > what is going on. I have the following code > import os > > def buildList( directory='/Users/mkonrad' ) > > dirs = [ ] > > listing = os.listdir(directory) > > for x in listing: >

Re: directory traverser

2005-07-09 Thread John Machin
Florian Lindner wrote: > Hello, > IIRC there is a directory traverser for walking recursively through > subdirectories in the standard library. But I can't remember the name and > was unable to find in the docs. Where did you look? How did you look? > Anyone can point me to it? Did you try Googl

Re: Directory in Windows

2005-04-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, custard_pie wrote: > Here's my code > > filelist={} > def listFiles(self, dirName, filesInDir): > for fname in filesInDir: > if os.path.isfile(fname): `fname` contains just the file name without t

Re: Directory in Windows

2005-04-30 Thread custard_pie
Here's my code filelist={} def listFiles(self, dirName, filesInDir): for fname in filesInDir: if os.path.isfile(fname): key = os.path.join(dirName, fname) stats = os.stat

Re: Directory in Windows

2005-04-30 Thread Kent Johnson
custard_pie wrote: Hi,..I tried to list files in a tree directory using os.path.walk. To avoid dirnames fromm being listed i use the os.path.isdir method. However, when isdir encounters directories that use spaces in their name e.q My Documents it doesn;t recognize them as directories.. Is there an

Re: directory bug on linux; workaround?

2005-01-17 Thread Ewald R. de Wit
Russell E. Owen wrote: > It seems that the path was to a "fat" file partition and included a > directory name that was all uppercase. The directory was created, but > using lowercase. I'm not yet sure the version of python. > > The workaround for now is to not use fat file partitions. But I was

Re: directory bug on linux; workaround?

2005-01-13 Thread John Lenton
On Thu, Jan 13, 2005 at 12:07:04PM -0800, Russell E. Owen wrote: > I stumbled across a really strange bug involving directories on linux. > > os.path.exists(path) can return 0 even after os.path.mkdir(path) > succeeds (well after; this isn't a timing issue). > > For the first file, the directory

Re: directory bug on linux; workaround?

2005-01-13 Thread Jeff Epler
Python is at the whim of the services the OS provides. Maybe you should ask in a linux-related newsgroup or mailing list, they might know more about the specifics of both detecting and working around "weird" filesystems like "fat". To find the type of a filesystem, Linux provides the statfs(2) fu

Re: Directory structure inside a ZipFile object

2004-12-09 Thread Bulba!
On Thu, 09 Dec 2004 07:42:57 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Look into the two-argument form of the write command: Well, I should have guessed that, it works. Thanks! > import zipfile > archive = zipfile.ZipFile('box.zip', 'w', zipfile.ZIP_DEFLATED) > archive.

Re: Directory structure inside a ZipFile object

2004-12-09 Thread Scott David Daniels
Bulba! wrote: tried to read file, zip it, and put in the target directory It works nice, except the zipfile created contains the directory path of the source file -- which I do NOT want to recreate. Look into the two-argument form of the write command: import zipfile archive = zipfile