stat.ST_BLKSIZE?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

stat.ST_BLKSIZE?

Chris Palmer-3
Hi there, I've got a random question. Why doesn't os.stat return the
filesystem's block size? Is there some other way to find that out in
Python? Googling the obvious ("python stat block size", "python stat
st_blksize") didn't reveal anything. Thanks.


--
http://www.noncombatant.org/
http://www.boshuda.com/

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: stat.ST_BLKSIZE?

Guido van Rossum
On 1/21/06, Chris Palmer <[hidden email]> wrote:
> Hi there, I've got a random question. Why doesn't os.stat return the
> filesystem's block size? Is there some other way to find that out in
> Python? Googling the obvious ("python stat block size", "python stat
> st_blksize") didn't reveal anything. Thanks.

Doesn't this work for you? It works for me (Linux Red Hat, version 7.2 or so.)

$ python2.2
Python 2.2.3+ (#94, Jun  4 2003, 08:24:18)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[startup.py ...]
[startup.py done]
>>> import os
>>> os.stat(".").st_blksize
4096
>>>

The value doesn't get returned as part of the 10-tuple, but it is
available through the (newer) attribute-based API, as long as the
underlying OS makes st_blksize available in its struct stat.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: stat.ST_BLKSIZE?

Chris Palmer-3
Guido van Rossum writes:

> The value doesn't get returned as part of the 10-tuple, but it is
> available through the (newer) attribute-based API, as long as the
> underlying OS makes st_blksize available in its struct stat.

That does indeed work for me (Python 2.3.5 on Mac OS X). Wow, thanks!

Now I feel dumb. I see now that I could have learned about this feature
from <http://python.org/doc/2.4.2/lib/os-file-dir.html>.

Will this API ever be cleaned up, having only one return value with all
items visible? It's confusing to show a tuple but to also have a secret
object with more stuff in it. To me, the natural choice of return value
is a dictionary containing everything the underlying OS provides.

Anyway, thanks again.


--
http://www.noncombatant.org/
http://www.boshuda.com/

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: stat.ST_BLKSIZE?

Guido van Rossum
On 1/21/06, Chris Palmer <[hidden email]> wrote:
> Will this API ever be cleaned up, having only one return value with all
> items visible? It's confusing to show a tuple but to also have a secret
> object with more stuff in it. To me, the natural choice of return value
> is a dictionary containing everything the underlying OS provides.

We'll clean it up in 3.0. Until then, we can't, for backwards
compatibility reasons that should be obvious.

As far as the "ideal" API, I much prefer attributes over a dict -- why
should I have to type quotes and square brackets when a dot will do?
There's always the introspection API (e.g. dir()) if for some obscure
reason you need the list of all supported names.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: stat.ST_BLKSIZE?

Warren DeLano
In reply to this post by Chris Palmer-3
> why should I have to type quotes and square brackets
> when a dot will do?

What about pickling/unpickling convenience?  Dictionaries don't have
class definition dependencies, and can thus be unpickled (anywhere &
anytime) without reference to external Python modules.

Or is there such a thing as a classless Python object that would combine
the syntactic convenience of attributes with the independent marshalling
of a dictionary?

(assuming of course that the container holds only builtin types, not
arbitrary objects).

Cheers,
Warren

--
Warren L. DeLano, Ph.D.                    
Principal Scientist

. DeLano Scientific LLC  
. 400 Oyster Point Blvd., Suite 213          
. South San Francisco, CA 94080 USA  
. Biz:(650)-872-0942  Tech:(650)-872-0834    
. Fax:(650)-872-0273  Cell:(650)-346-1154
. mailto:[hidden email]      
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Guido van Rossum
> Sent: Saturday, January 21, 2006 6:38 PM
> To: Chris Palmer
> Cc: [hidden email]
> Subject: Re: [Baypiggies] stat.ST_BLKSIZE?
>
> On 1/21/06, Chris Palmer <[hidden email]> wrote:
> > Will this API ever be cleaned up, having only one return value with
> > all items visible? It's confusing to show a tuple but to
> also have a
> > secret object with more stuff in it. To me, the natural choice of
> > return value is a dictionary containing everything the
> underlying OS provides.
>
> We'll clean it up in 3.0. Until then, we can't, for backwards
> compatibility reasons that should be obvious.
>
> As far as the "ideal" API, I much prefer attributes over a
> dict -- why should I have to type quotes and square brackets
> when a dot will do?
> There's always the introspection API (e.g. dir()) if for some
> obscure reason you need the list of all supported names.
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Baypiggies mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/baypiggies
>
>
>
>
_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: stat.ST_BLKSIZE?

Keith Dart-2
On Sun, 22 Jan 2006 12:00:57 -0800
"Warren DeLano" <[hidden email]> wrote:

> Or is there such a thing as a classless Python object that would
> combine the syntactic convenience of attributes with the independent
> marshalling of a dictionary?

I have created such a thing. Attached is the source file.


--

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Keith Dart <[hidden email]>
   public key: ID: 19017044
   <http://www.kdart.com/~keith/>
   =====================================================================

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies

dictlib.py (3K) Download Attachment
signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

DNS

Dennis Reinhardt
In reply to this post by Warren DeLano
I am working to fix a security hole in the baypiggies.net domain and
evidently have now pointed back to an out of date home page.  Ooops.  Under
investigation and repair.
------------------------------------
| Dennis    | [hidden email]     |
| Reinhardt | Powerful Anti-Spam   |
| http://dair.com/py/planmeet.html |
------------------------------------

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: DNS

Dennis Reinhardt
At 11:39 AM 5/19/2006, Dennis Reinhardt wrote:
>I am working to fix a security hole in the baypiggies.net domain and
>evidently have now pointed back to an out of date home page.  Ooops.  Under
>investigation and repair.

In the meantime, the following URL will reach the baypiggies website:

         http://baypiggies.python-hosted.com/

The corresponding IP address of 67.15.112.31 cannot be used in a web
request.  I hope this is nothing more squirrely than a missing host header
in http 1.1.  The new DNS should be propagating now (with emphasis on
should be).

The baypiggies.net address is still incorrectly resolving to Deirdre's
years old page.



------------------------------------
| Dennis    | [hidden email]     |
| Reinhardt | Powerful Anti-Spam   |
| http://dair.com/py/planmeet.html |
------------------------------------

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: DNS

Dennis Reinhardt
In reply to this post by Dennis Reinhardt

The domain name changes have propagated.

Rick Moen has volunteered to continue providing slave DNS service for us in
the linuxmafia.com domain.  Unfortunately, that is not possible at this
time.  The current registrar has a brain-dead piece of coding where they
will not recognize their default name servers as legal DNS servers for
purposes of making additions.

Perhaps there is a workaround (get them to fix, assign all names
explicitly, make potion using bat wings, etc.).  ... but I intend to change
registrars anyway (better control panel, really excellent tech/cust
service, and, ahem, much less expensive).

The most convenient time to change registrars is very shortly after a
meeting so that people wanting to find out meeting info are not
inconvenienced.  Our next regular meeting is June 8.  I plan to start the
registrar transfer June 9.  I plan to add linuxmafia.com back as a slave
DNS at the time I move to new registrar.

In this DNS change, the following machines have been removed as nameservers:

        NS2.BAYPIGGIES.NET  198.144.195.190
    NS2.WEBL.COM        66.239.72.24
        NS1.WEBL.COM       71.2.114.159

for security and configuration reasons.  Unless I hear reasons to the
contrary, I will not add them back.


------------------------------------
| Dennis    | [hidden email]     |
| Reinhardt | Powerful Anti-Spam   |
| http://dair.com/py/planmeet.html |
------------------------------------

_______________________________________________
Baypiggies mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/baypiggies