DHT for Python 3.x?

2009-11-10 Thread Salim Fadhley
There are plenty of good DHT projects for Python 2.x, however from
what I can tell none of them have made the jump to 3.x yet.

I'm really keen to support Python 3.x for a project I'm working on. I
know that many developers (correctly) consider switching to Python 3
foolish since it is less supported at the moment, but nevertheless I
am keen to carry on.

So can somebody recommend me a working implementation of a DHT which
will work on Python 3.x and preferably Python 2.6 as well.

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


How do I find the memory used by a python process

2008-11-03 Thread Salim Fadhley
I'm trying to create a python unit-test which will test a complex
program which includes a number of functions which have been
implemented in C or C++.

The unit-test needs to check that after the functions have been run a
few thousand times all of the memory used by those functions has been
un-allocated, i.e. that there are no memory leaks.

I was wondering if there is some way of finding out how much memory
the current thread is using. I would like some kind of simple function
call that gives me the current memory usage of the current process or
thread.

So each test would check the amount of memory available, call the
function N times and then check the amount of memory available
afterwards. If the amount of memory before and after changes by a
certain amount then the test is failed.

All of our unit-tests are single threaded processes. We run Windows
and Python 2.4.

Any suggestions? Thanks!

Sal
--
http://mail.python.org/mailman/listinfo/python-list


Retrieve Win32 domain name

2008-08-26 Thread Salim Fadhley
I'm looking for a method to retrieve a Windows Domain name (not a DNS
Domain name).

I know this can be done by simply reading an environment variable,
however on the machines I need to work with sometimes the environment
variables can be messed-up and are not trustworthy.

Is there somebody who knows the Win32 library who can point me to the
function I need? The Win32Net seems to contain a whole load of
functions for manipulating Windows networking resources, however I
couldn't find a function which simply returned information about the
local computer.

Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


Retrieve Win32 domain name

2008-08-26 Thread Salim Fadhley
I'm looking for a method to retrieve a Windows Domain name (not a DNS
Domain name).

I know this can be done by simply reading an environment variable,
however on the machines I need to work with sometimes the environment
variables can be messed-up and are not trustworthy.

Is there somebody who knows the Win32 library who can point me to the
function I need? The Win32Net seems to contain a whole load of
functions for manipulating Windows networking resources, however I
couldn't find a function which simply returned information about the
local computer.

Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why nested scope rules do not apply to inner Class?

2008-08-12 Thread Salim Fadhley
 I'm wondering as well if the new nonlocal statement will fix that in py3k?

The class C3 statement is executing before the class B statement
has concluded, so at that time B does not exist in any scope at all,
not even globals(). You could reference B.C1 inside a method because a
method is executed AFTER the class is defined.
class A(object):
pass

class B(object):

class C1(object):
pass

class C2(C1):
foo = A

class C3(object):

@staticmethod
def test(  ):
print repr( B.C1 )
print repr( B.C2 )

B.C3.test()

:-)
--
http://mail.python.org/mailman/listinfo/python-list


Using UNC paths for --find-links in easy_install on Windows

2008-08-12 Thread Salim Fadhley
A project I'm working on requires a Python egg to be deployed to a
remote location which (because of a security configuration outside my
control) denies users web-access but allows users access to networked
file-systems. It has been proposed that rather than creating a web-
repository for python eggs we store these on a local file-server.

Has anybody had any luck using the --find_options argument to
easy_install with a local folder (e.g. on a Windows C: Drive) or a
network folder, for example

easy_install --find-links=http://server/egs; myegg==1.0.1

that sort of thing works fine

but what about:

easy_install --find-links=c:\myeggs\ myegg==1.0.1

or even:

easy_install --find-links=file:///c:/myeggs myegg==1.01
--
http://mail.python.org/mailman/listinfo/python-list


Python / Windows process control

2008-07-09 Thread Salim Fadhley
Does anybody know of a python module which can do process management
on Windows? The sort of thing that we might usually do with
taskmgr.exe or process explorer?

For example:

* Kill a process by ID
* Find out which process ID is locking an object in the filesystem
* Find out all the IDs of a particular .exe file
* Find all the details of a currently running process (e.g. given an
ID tell me which files it uses, niceness, runtime)

Thanks!

Sal
--
http://mail.python.org/mailman/listinfo/python-list