Development Team/Almanac/lang-es: Difference between revisions

Fede (talk | contribs)
Fede (talk | contribs)
Line 201: Line 201:
</pre>
</pre>


=== How do I get the amount of free space available on disk under the /home directory tree? ===
=== ¿Cómo puedo obtener la cantidad de espacio libre disponible en el disco dentro el directorio /home? ===
The following function uses the [http://docs.python.org/lib/module-statvfs.html statvfs] module. The following code demonstrates how to get the total amount of free space under /home.  
La siguiente función usa el módulo [statvfs http://docs.python.org/lib/module-statvfs.html]. El código siguiente muestra cómo obtener la cantidad total de espacio libre en / home.  


<pre>
<pre>
     #### Method: getFreespaceKb, returns the available freespace in kilobytes.  
     #### Method: getFreespaceKb, devuelve el espacio disponible en kilobytes.  
     def getFreespaceKb(self):
     def getFreespaceKb(self):
         stat = os.statvfs("/home")
         stat = os.statvfs("/home")
Line 212: Line 212:
         return freekb
         return freekb
</pre>
</pre>
Ten en cuenta que asumir cosas acerca de "/home" no es una buena idea, es mejor usar os.environ['HOME']. Rainbow pondrá los archivos actuales en otros lugares, algunos en el ramdisk, otros en la flash.


Note, however, that assuming anything about "/home" is a bad idea, better use os.environ['HOME'] instead.  Rainbow will put your actual files elsewhere,
Note, however, that assuming anything about "/home" is a bad idea, better use os.environ['HOME'] instead.  Rainbow will put your actual files elsewhere,
some on ramdisks, some on flash. Be clear about which filesystem's free space you actually care about.
some on ramdisks, some on flash.
Ten en claro que el espacio libre en el sistema de archivos realmente te importa importa.


=== How do I know whether my activity is running on a physical XO? ===
=== How do I know whether my activity is running on a physical XO? ===