Re: Measure the amount of memory used?

2011-08-18 Thread MrJean1
Take a look it this recipe (for Linux only): /Jean On Aug 18, 8:08 am, Jack Bates wrote: > I wrote a content filter for Postfix with > Python,https://github.com/jablko/cookie > > It should get started once, and hopefully run for a long time - so I'

Re: Get the IP address of WIFI interface

2011-05-15 Thread MrJean1
Perhaps, this recipe works for your case: It does parse ifconfig and ipconfig, if found. /Jean On May 15, 2:14 pm, Andrew Berg wrote: > On 2011.05.15 06:12 AM, Tim Golden wrote:> ... and for Windows: > > > > > import wmi > > > for nic in wmi.WM

Merging pdf files based on a value in a field

2017-09-08 Thread MrJean1
Try PyPDF2, see the merge example. /Jean -- https://mail.python.org/mailman/listinfo/python-list

Re: Quick way to calculate lines of code/comments in a collection of Python scripts?

2016-10-24 Thread MrJean1
On Wednesday, October 5, 2016 at 1:57:14 PM UTC-4, Malcolm Greene wrote: > Looking for a quick way to calculate lines of code/comments in a > collection of Python scripts. This isn't a LOC per day per developer > type analysis - I'm looking for a metric to quickly judge the complexity > of a set of

best text editor for programming Python on a Mac

2016-06-18 Thread MrJean1
Try TextWrangler from BareBones . I've been using that for years on MacOS X. /Jean -- https://mail.python.org/mailman/listinfo/python-list

Re: memoru usage of process

2005-09-27 Thread MrJean1
On Linux, this may work for you /Jean Brouwers Jacek Poplawski wrote: > I need to know how much memory uses child process (after > subprocess.Popen), so I want function: > > get_memory_usage(pid) > > I found two ways: > > - cal

Re: Human readable number formatting

2005-09-28 Thread MrJean1
Here is another function for human formatting: def sistr(value, prec=None, K=1024.0, k=1000.0, sign='', blank=' '): ''' Convert value to a signed string with an SI prefix. The 'prec' value specifies the number of fractional digits to be included. Use 'prec=0' to omit any fr

Re: Human readable number formatting

2005-09-28 Thread MrJean1
No, I didn't. See the references at the bottom. /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: memoru usage of process

2005-09-28 Thread MrJean1
What do you mean by 'Python way' and 'not related to Python'? How is parsing the output of 'ps' different from the method used in recipe 286222? /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: Parser suggestion

2005-09-29 Thread MrJean1
My recommendation for a project like this would be SimpleParse Some examples are here and /Jean Brouwers -- http://m

Re: what does 0 mean in MyApp(0)

2005-10-02 Thread MrJean1
See the documentation for the __init__() method here Btw, this is wxPython 2.6, AFAIK. /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread MrJean1
My suggestion would also be to use sbrk() as it provides a high-water mark for the memory usage of the process. Below is the function hiwm() I used on Linux (RedHat). MacOS X and Unix versions are straigthforward. Not sure about Windows. /Jean Brouwers #if _LINUX #include size_t hiwm (void)

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-15 Thread MrJean1
For some more details on Linux' mallinfo, see and maybe function mSTATs() in glibc/malloc/malloc.c (RedHat). /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-15 Thread MrJean1
For some more details on Linux' mallinfo, see and maybe function mSTATs() in glibc/malloc/malloc.c (RedHat). /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-15 Thread MrJean1
This may work on MacOS X. An initial, simple test does yield credible values. However, I am not a MacOS X expert. It is unclear which field of the malloc_statistics_t struct to use and how malloc_zone_statistics with zone NULL accumulates the stats for all zones. /Jean Brouwers #if _MACOSX #in

Re: So what are __slots__ and when should I use them?

2005-11-15 Thread MrJean1
Here is an example of the difference between a class with __slots__ and __dict__ /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: what happens when the file begin read is too big for all lines to be read with "readlines()"

2005-11-19 Thread MrJean1
Just try it, it is not that hard ... ;-) /Jean Brouwers PS) Here is what happens on Linux: $ limit vmemory 1 $ python ... >>> s = file().readlines() Traceback (most recent call last): File "", line 1 in ? MemoryError >>> -- http://mail.python.org/mailman/listinfo/python-l

Re: Estimating memory use?

2005-11-27 Thread MrJean1
There is a function mx_sizeof() in the mx.Tools module from eGenix which may be helpful. More at /Jean Brouwers PS) This is an approximation for memory usage which is useful in certain, simple cases. Each built-in type ha

Re: Estimating memory use?

2005-11-27 Thread MrJean1
The name of the function in mx.Tools is sizeof() and not mx_sizeof(). My apologies. Also, it turns out that the return value of mx.Tools.sizeof() function is non-aligned. For example mx.Tools.sizeof("abcde") returns 29 which is fine, but not entirely "accurate". /Jean Brouwers -- http://mail.p

Re: best way to discover this process's current memory usage, cross-platform?

2005-12-01 Thread MrJean1
Did you try the function I posted on Nov 15? It returns the high water mark, like sbrk(0) and works for RH Linux (which is dlmalloc, AFAIK). /Jean Brouwers PS) Here is that code again (for RH Linux only!) size_t hiwm (void) { /* info.arena - number of bytes allocated * info.hblkhd -

Re: Counting processors

2005-07-26 Thread MrJean1
Or maybe os.sysconf('SC_NPROCESSORS_ONLN') Usually, the value returned by os.sysconf('SC_NPROCESSORS_ONLN') and os.sysconf('SC_NPROCESSORS_CONF') are the same, but if they do differ, os.sysconf('SC_NPROCESSORS_ONLN') is the reliably figure. /Jean Brouwers PS) This applies to Linux and Solari

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread MrJean1
Two observations: 1 - The difference in run time with and without the dummy* globals is due to a difference in the number of invokations of the search() function: 1,140 resp. 27,530 in my environment. To verify, just change the line def search(): to searches = 0 def search():

Re: Suppressing checking of modules with pychecker

2005-08-25 Thread MrJean1
FWIIW, We use PyChecker all the time with Python files using importing wx plus wx.grid or wx.stc, etc. and the run times vary between 5 and 15 seconds. This is Python 2.4 with wxPython 2.4.2.4 and RedHat Fedora Core 2 Linux running on a 1.2 GHz Pentium 4 M laptop. /Jean Brouwers -- http://mail

Re: File parser

2005-08-30 Thread MrJean1
Take a closer look at SimpleParse/mxTextTools We have used these to parse log files of several 100 MB with simple and complex grammars up to 250+ productions. Highly recommended. /Jean Brouwers PS) For an introduction see also this story

Re: wxPython StyledTextCtrl and tabs?

2005-09-13 Thread MrJean1
Maybe the SetUseTabs() method helps. See this page and the summary at the top. Disclaimer: untested. /Jean Brouwers Lonnie Princehouse wrote: > Does anyone know of a way to make the wxPython StyledTextCtrl expand > tabs into spaces?

Re: Text & Unicode processing references on the web.

2005-04-14 Thread MrJean1
Check David Mertz' book and web site to start. There is more in some of the list here . /Jean Brouwers anthony hornby wrote: > Hi, > I am starting my honours degree project and part of it is going to be > manipulating AS

Re: whitespace , comment stripper, and EOL converter

2005-04-16 Thread MrJean1
Great tool, indeed! But doc strings stay in the source text. If you do need to remove doc strings as well, add the following into the __call__ method. ... # kill doc strings ... if not self.docstrings: ... if toktype == tokenize.STRING and len(toktext) >= 6: ...

Re: whitespace , comment stripper, and EOL converter

2005-04-17 Thread MrJean1
There is an issue with both my and your code: it only works if doc strings are triple quoted and if there are no other triple quoted strings in the Python code. A triple quoted string used in an assignment will be removed, for example this case s = '''this string should not be removed''' It

Re: whitespace , comment stripper, and EOL converter

2005-04-19 Thread MrJean1
Attached is another version of the stripper.py file. It contains my change which seem to handle docstring correctly (at least on itself). /Jean Brouwers ## # Python source stripper / cleaner ;) ###

How to get all IP addresses in python?

2016-02-24 Thread MrJean1
Try function getIPs from this module /Jean -- https://mail.python.org/mailman/listinfo/python-list

Re: Fixing Python install on the Mac after running 'CleanMyMac'

2015-05-29 Thread MrJean1
FWIW, I recently upgraded an older MacBook to Mac OS X 10.7.5 and there are 3 different versions of Python in /System/Library/Frameworks/Python.framework, see: $ ls /System/Library/Frameworks/Python.framework/Versions/ 2.5 2.6 2.7 Current It is unclear whether MacOS X 10.7.5 instal

Re: Fixing Python install on the Mac after running 'CleanMyMac'

2015-05-29 Thread MrJean1
Correct, the "Current" version is just a link to "2.7". Also, the binaries '/usr/bin/python{,w}" seem to be copies of the "/System/Library/.../Versions/2.7/bin/python{,w}" files. /Jean On Friday, May 29, 2015 at 2:01:05 PM UTC-4, Ned Deily wrote: >

Create on Win and run on Win or Mac

2015-06-01 Thread MrJean1
See this thread for possible answers /Jean -- https://mail.python.org/mailman/listinfo/python-list

Re: fork/exec & close file descriptors

2015-06-12 Thread MrJean1
The subprocess module uses upper bound MAXFD which is defined as try: MAXFD = os.sysconf("SC_OPEN_MAX") except: MAXFD = 256 /Jean -- https://mail.python.org/mailman/listinfo/python-list

Re: How to calculate the CPU time consumption and memory consuption of any python program in Linux

2005-12-24 Thread MrJean1
For CPU time usage, see the standard time module specifically the time.clock() function. For memory usage see /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-l

Re: releasing memory to malloc

2006-10-05 Thread MrJean1
The memory manager in the latest Python release 2.5 does return freed memory to the underlying system, if possible. For more details, see the 5th bullet on this page . /Jean Brouwers [EMAIL PROTECTED] wrote: > The workaround I went with made use of

Re: profiling memory usage

2006-10-06 Thread MrJean1
The latest Python release 2.5 includes improvements to the memory manager and *may* work better for you, it all depends on the root cause of the problem. For more details, see the 5th bullet on this page . /Jean Brouwers Eddie wrote: > Hi, > > I am lo

Re: Dumping the state of a deadlocked process

2006-10-06 Thread MrJean1
Did you try using the signal module? If not, a basic example is here which may need to be extended. /Jean Brouwers [EMAIL PROTECTED] wrote: > Hi all > > I'm currently having some issues with a process getting deadlocked. The > problem is that the only w

Re: Dumping the state of a deadlocked process

2006-10-07 Thread MrJean1
[EMAIL PROTECTED] wrote: > MrJean1 wrote: > > Did you try using the signal module? If not, a basic example is here > > <http://docs.python.org/lib/node546.html> which may need to be > > extended. > > I looks useful. I gave it a try, and the only weakness it has is

Re: print time comparison: IDLE versus terminal on ultra 20

2006-10-08 Thread MrJean1
On my Ultra 20 box, the test program takes 0.00039982 secs in a terminal window and 0.236839 secs in IDLE, i.e. about 600x slower. This is ActivePython 2.4.3 for Solaris 10 on a 2+ GHz Opteron. A partial explanation for the difference in run time between terminal and IDLE is that IDLE uses thru a

Re: print time comparison: IDLE versus terminal on ultra 20

2006-10-09 Thread MrJean1
With the binaries /usr/sfw/bin/python and /usr/sfw/bin/idle the results are 0.002279 resp. 0.222831 secs for the same print test. The Python version is 2.3.3 and IDLE version 1.0.2 on the same Ultra 20 Opteron box running Solaris 10. /Jean Brouwers sam wrote: > i forgot to mention that i'm ru

Re: Compile python on Solaris 64bit

2006-10-12 Thread MrJean1
I did build Python 2.5 on a Solaris 10 Ultra 20 machine (Opteron) but using the SUN compilers. Two changes were needed in the Makefile: CXX=CC and CCSHARED=-KPIC. There are a few issues which I have not investigated further (like Tcl and ffitarget.h), but the tests pass except for 3 unexpected sk

Re: wxPython help wxSashWindow

2006-10-19 Thread MrJean1
Take a look at the "wxSashWindow" example in the wxPython demo. That is located under the Core Windows/Controls item. /Jean Brouwers MatthewWarren wrote: > Hi, I'm wondering if anyone can tell me here, or point to a specific > tutorial ( I have searched for 1/2hour, but can find only referenc

Re: Compile for 64bit RHEL

2006-10-19 Thread MrJean1
Both Python 2.4.4 and 2.5 built just fine on my Opteron box with RHEL (release 3 update 7). There are no test failures, only 35 skipped tests (which are expected on Linux). /Jean Brouwers Christopher Taylor wrote: > Has anyone been able to get python 2.4 to compile properly for x86_64 RHEL? >

Re: Detecting 64bit vs. 32bit Linux

2006-07-08 Thread MrJean1
Try function architecture() from the platform module in Python 2.3 and 2.4. The first item of the returned tuple shows whether the underlying system is 64-bit capable. Here is what it returns on RedHat Fedora Core 2 Linux on Opteron: >>> platform.architecture() ('64bit', 'ELF') >>> platform.unam

Re: How to evaluate the memory usage of a python program?

2006-09-20 Thread MrJean1
Iff you are using Python on Linux, here is one option which may work for you /Jean Daniel Mark wrote: > Hello all: > > I have a python program and would like to find out the maximum memory > used > by this program. > > Does Pyth

Re: python interpreter on solaris 10

2006-09-25 Thread MrJean1
FWIIW, On my stock Ultra 20 / Solaris 10 / Opteron box, python, idle, etc. just run fine provided /usr/sfw/bin is in your PATH environment variable. That is Python 2.3.3, however. In addition, I installed the Python 2.4.3 build for Solaris from ActiveState and python, idle, etc. run without any

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread MrJean1
Take look at the poll() methods in the subprocess.py source file of your Python install. It shows how to use the os.wait_pid(pid, os.WNOHANG) to check whether a process is still running or has terminated (and how, from the returned status value). Btw, on *nix you must call os.wait_pid(pid, ...) t

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread MrJean1
Take look at the poll() methods in the subprocess.py source file of your Python install. It shows how to use the os.wait_pid(pid, os.WNOHANG) to check whether a process is still running or has terminated (and how, from the returned status value). Btw, on *nix you must call os.wait_pid(pid, ...) t

Re: PySizeof: almost useful

2006-02-12 Thread MrJean1
Check the sizeof() method in the mxTools package from eGenix: /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: Use of __slots__

2006-02-27 Thread MrJean1
An example of the RARE use case may be this particular one /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess Not Working on Solaris

2007-06-15 Thread MrJean1
FWIIW, on my Solaris 10 (Opteron) machine, there are no import subprocess errors, not with Python 2.4.3 nor with Python 2.5. /Jean Brouwers PS) Python 2.4.3 is the ActivePython Solaris build 11 from ActivState. Python 2.5 was built from source using SUN compilers, not GNU. There is an ActivePyt

Re: 32 OS on 64-bit machine

2007-05-03 Thread MrJean1
$ python Python 2.5c1 (r25c1:51305, Sep 12 2006, 08:39:50) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import platform >>> print platform.processor() x86_64 >>> print platform.architecture() ('64bit', 'ELF') >>>

Re: How to create pid.lock via python?

2007-03-05 Thread MrJean1
May this works for your case . /Jean Brouwers On Mar 5, 3:12 am, Marco <[EMAIL PROTECTED]> wrote: > Hello, > > I write a program control a device via RS232, I hope to add some code > to let the program canNOT be used by other peo

Re: good example of C extension for Mac OS X

2007-10-27 Thread MrJean1
There is a C template in file Modules/xxmodule.c in Python 2.5, maybe earlier. /Jean Brouwers On Oct 27, 8:11 am, chewie54 <[EMAIL PROTECTED]> wrote: > Hi All, > > Does anyone now of a good example to use as template for a C program > extension that needs to be built on the Mac OS X. > > Thanks

Re: good example of C extension for Mac OS X

2007-10-27 Thread MrJean1
There is a C template in file Modules/xxmodule.c in Python 2.5, maybe earlier. /Jean Brouwers On Oct 27, 8:11 am, chewie54 <[EMAIL PROTECTED]> wrote: > Hi All, > > Does anyone now of a good example to use as template for a C program > extension that needs to be built on the Mac OS X. > > Thanks,

Re: good example of C extension for Mac OS X

2007-10-27 Thread MrJean1
You will need to download the MacOS X version from <http://www.python.org/download/releases/2.5.1/>. It contains the source code. /Jean Brouwers On Oct 27, 12:31 pm, chewie54 <[EMAIL PROTECTED]> wrote: > On Oct 27, 2:59 pm, MrJean1 <[EMAIL PROTECTED]> wrote: > >

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Maybe this helps. Using ./configure --without-gcc in Python 2.5.1 on Solaris 10 gives a different message. That message indicates that C++ compiler 'c++' will be used but the Studio C++ compiler on Solaris is 'CC'. Using ./configure --without-gcc --with-cxx-main=CC made that message

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Building 64-bit Python is still elusive. I tried various ways to add - xtarget=opteron -xarch-amd64 to the C/C++ flags but that still fails to produce a 64-bit build. Changing the Makefile is not sufficient since that causes compilation errors. It looks like the ./configure command must run wit

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
5.8 2005/10/14 on an Ultra 20 Opteron machine On Oct 29, 12:06 pm, MrJean1 <[EMAIL PROTECTED]> wrote: > Building 64-bit Python is still elusive. I tried various ways to add - > xtarget=opteron -xarch-amd64 to the C/C++ flags but that still fails > to produce a 64-bit build. Chan

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Correction: the number of tests which pass must be 276. /Jean Brouwers On Oct 29, 10:29 pm, MrJean1 <[EMAIL PROTECTED]> wrote: > Here is a better way to build Python on Solaris, both 32- and 64- > bit. > > <http://ccnuma.anu.edu.au/~wpc/blog/programming/building-pyth

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
skips. The latter are expected and due to missing packages, like Tcl. Use the instructions from this site and forget mine. But it may still be necessary to patch the ./Include/pyport.h file as shown in my previous message. /Jean Brouwers On Oct 29, 9:15 pm, MrJean1 <[EMAIL PROTECTED]> w

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-30 Thread MrJean1
Building 64-bit Python 2.4.4 on Solaris 10 and SUC C/C++ using the instructions from worked just fine on Ultra 20 Opteron machine. The test result summary is below. /Jean Brouwers 249 tests OK. 2 tests failed: te

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-30 Thread MrJean1
On final comment. For 64-bit usage, Python 2.5.1 is the better choice. More on that here <http://docs.python.org/whatsnew/pep-353.html>. /Jean Brouwers On Oct 30, 10:15 am, MrJean1 <[EMAIL PROTECTED]> wrote: > Building 64-bit Python 2.4.4 on Solaris 10 and SUC C/C++ using the

Re: why did these companies choose Tcl over Python

2007-10-30 Thread MrJean1
That is correct. Tcl has it roots at UC Berkeley and was originally used to provide a command line interface for electronic design automation (EDA) tools. Most commercial EDA vendors at that time were using their own, proprietary command language. Only later became Tcl widely adopted among EDA v

Re: Asyncore select statement problem

2007-01-17 Thread MrJean1
Try using another ascyncore example and see if that works for you. Maybe, first one without threading, like Asyncore worked fine on my application on Linux, but haven't tried that on MacOS. /Jean Brouwers JamesHoward wr

Re: Match 2 words in a line of file

2007-01-18 Thread MrJean1
Without using re, this may work (untested ;-): def lines_with_words(file, word1, word2): """Print all lines in file that have both words in it.""" for line in file: words = line.split() if word1 in words and word2 in words: print line /Jean Brouwers Rickard

Re: Best Free and Open Source Python IDE

2007-02-08 Thread MrJean1
On Feb 8, 6:03 am, "Srikanth" <[EMAIL PROTECTED]> wrote: > Yes, > > All I need is a good IDE, I can't find something like Eclipse (JDT). > Eclipse has a Python IDE plug-in but it's not that great. Please > recommend. > > Thanks, > Srikanth Here is a list

Re: Populating a dictionary, fast

2007-11-12 Thread MrJean1
On MacOS** your version #!/usr/bin/python v = {} for line in open('keys.txt'): v[long(line.strip())] = True using these keys takes 24.9 secs with ActivePython 2.5.1 and 212.3 secs with Apple's Python 2.3.5. However, this version #!/usr/bin/py

Re: Catching a segfault in a Python library

2007-11-24 Thread MrJean1
Try catching SIGSEGV using the Python signal module An example (for SIGALRM) is on the next page However, it may not work since a SIGSEGV fault is pretty much the end of everything :-( /Jean Brouwers

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread MrJean1
My milage does vary, see this older post Similar figures are shown with Python 2.5, both for 32- and 64-bit. /Jean Brouwers On Dec 21, 12:07 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > >      I'd like

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread MrJean1
You are correct. Mea culpa. /Jean Brouwers On Dec 21, 1:41 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > MrJean1 wrote: > > My milage does vary, see this older post > > >   <http://mail.python.org/pipermail/python-list/2004-May/261985.html> > > > Si

Re: CPython and a C extension using Boehm GC

2007-12-25 Thread MrJean1
Perhaps, you can pre-load the extension library when Python is invoked. It is probably trying. Pre-loading is commonly done done for memory management and profiling libraries and it may (or may not) work for libraries including the Boehm-GC. And if it does work, call GC_INIT inside the initializa

Re: CPython and a C extension using Boehm GC

2007-12-25 Thread MrJean1
Correction. The second line should be ... It is probably worth trying. /Jean Brouwers On Dec 25, 12:19 pm, MrJean1 <[EMAIL PROTECTED]> wrote: > Perhaps, you can pre-load the extension library when Python is > invoked. It is probably trying. > > Pre-loading is commonly do

Re: CPython and a C extension using Boehm GC

2007-12-26 Thread MrJean1
It depends on how the GC inside the extension is built. If it is a drop-in replacement for malloc, then GC *must* be loaded and initialized upfront if possible. There is no need to memcpy anything between Python and the extension. However, if GC does not replace malloc, etc., then GC-ed memory i

Re: CPython and a C extension using Boehm GC

2007-12-26 Thread MrJean1
anyway. /Jean Brouwers On Dec 26, 7:14 am, MrJean1 <[EMAIL PROTECTED]> wrote: > It depends on how the GC inside the extension is built.  If it is a > drop-in replacement for malloc, then GC *must* be loaded and > initialized upfront if possible.  There is no need to memcpy any

Re: TextWrangler and new Python version (Mac)

2008-01-05 Thread MrJean1
On Jan 4, 3:33 pm, cf29 <[EMAIL PROTECTED]> wrote: > I installed Python 2.5 on my Mac (OS X Tiger). When running scripts > with the TextWrangler Run command it is using the system installed > version of Python (2.3). If I run the scripts with the Apple Terminal > it uses the new version (2.5). > >

Re: Detecting OS platform in Python

2008-01-11 Thread MrJean1
On Jan 10, 7:53 pm, Benjamin <[EMAIL PROTECTED]> wrote: > On Jan 10, 8:37 pm, Devraj <[EMAIL PROTECTED]> wrote:> Hi everyone, > > > My Python program needs reliably detect which Operating System its > > being run on, infact it even needs to know which distribution of say > > Linux its running on. T

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread MrJean1
Here are some examples using urllib.urlretrieve(): /Jean Brouwers On Jan 10, 2:23 pm, Chris Rebert wrote: > On Sat, Jan 10, 2009 at 9:12 AM, David Shi wrote: > > I am looking for an ef

Re: simplest way to strip a comment from the end of a line?

2008-12-04 Thread MrJean1
Using rsplit('#', 1) works for lines *with* comments: >>> 'this is a test'.rsplit('#', 1) ['this is a test'] >>> 'this is a test #with a comment'.rsplit('#', 1) ['this is a test ', 'with a comment'] >>> "this is a '#gnarlier' test #with a comment".rsplit('#', 1) ["this is a '#gnarlier' test ", '

Re: trapping all method calls in a class...

2008-12-21 Thread MrJean1
The decorate_meths() function as given fails: TypeError: 'dictproxy' object does not support item assignment But this version avoids that error (on Python 2.2 thru 2.6): def decorate_meths(klass): for nam, val in klass.__dict__.items(): if callable(val): setattr(klass,

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread MrJean1
There is a module called sched in the standard Python library /Jean Brouwers John Dann wrote: > I need what I'd call (in .Net) a timer, ie I need to run a function eg > every 2 seconds - it doesn't need to be millisec accurate but it would > be

Re: Not Sure This Can Be Done...

2008-04-01 Thread MrJean1
In any script upon startup, sys.path[0] contains the full path of the directory where the script is located. See under 'path'. it should be straightforward from here (untested though). In each script, get the sys.path[0] string, split it using os.pat

Re: Python test case management system?

2008-09-04 Thread MrJean1
Perhaps Qmtest fits your needs /Jean On Sep 4, 4:36 pm, Mudcat <[EMAIL PROTECTED]> wrote: > I had originally planned on writing my own software for managing test > cases; however new boss = new directive. This will make it more > difficult to get t

Re: calculating system clock resolution

2006-04-07 Thread MrJean1
Depends iff you are using Linux, print cat /proc/cpuinfo and look for the line "cpu ...Hz: ...". Parsing that would be straightforward. Keep in mind, the time.time() function reports the "wall clock" time, which usually has up to a millisecond resolution, regardless of the CPU speed.

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-29 Thread MrJean1
Take a look at function timelimited in this recipe /Jean On Nov 29, 8:08 am, r0g wrote: > r0g wrote: > > r0g wrote: > >> Gabriel Genellina wrote: > >>> En Fri, 27 Nov 2009 22:35:36 -0300, r0g > >>> escribió: > > gethostbyname ignores setdefa

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread MrJean1
Try using the function timelimited from this recipe An (untested) example with a 60 second timeout would be: try: r = timelimited(60, raw_input, 'enter right or wrong: ') except TimeLimitExpired: except KeyboardInterrupt: /Jean

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread MrJean1
Brendan, The timeout argument of the FTP class (and the connect method) is used only to establish the connection to FTP sockets. If the timeout expires, an error called socket.timeout is raised. AFAIK, the timeout argument does not limit FTP transfers. To impose a time limit on FTP transfers, t

Re: How to monitor memory usage within Python? (Linux)

2010-02-24 Thread MrJean1
For Linux only /Jean On Feb 24, 2:35 pm, kj wrote: > Is there some standard module for getting info about the process's > memory usage, in a Linux/Unix system? > > (I want to avoid hacks that involve, e.g., scraping ps's output.) > > Thanks! > > ~K

Re: ctypes question

2010-12-11 Thread MrJean1
It is not entirely clear what the functions and especially what their signatures are in that C library clibsmi. In general, for shared libraries, you need to define those first as prototype using ctypes.CFUNCTYPE() and then instantiate each prototype once supplying the necessary parameter flags us

Re: ctypes question

2010-12-14 Thread MrJean1
Try again after changing line 16 to sn = SmiGetNode(None, "1.3.6.1.2.1.2.2") Because, SmiGetNode is a Python function which accepts Python objects as arguments. Passing is a ctypes object oid is incorrect. /Jean On Dec 14, 10:36 am, News Wombat wrote: > On Dec 11, 12:59 pm, M

Re: how to measure TCP congestion windows using python ??

2010-12-20 Thread MrJean1
FWIW, on CentOS 4.7, the ctypes version works fine, but the struct version fails, because len(tcp_info) is only 100 bytes while struct.calcsize('B...L') is 104. However, if the format is changed to '7B23L', i.e. one 'L' shorter, the struct version works and returns to same result as the ctypes ver

Re: Compile on SunOS?

2010-12-31 Thread MrJean1
These command lines used to build 32-bit Python 2.4 and 2.5 on Solaris 10 Opteron using SUN's compilers: setenv LD_LIBRARY_PATH env CCSHARED="-KPIC" LDSHARED="cc -xtarget=native -G" LDFLAGS="- xtarget=native" CC="cc" \ CPP="cc-xtarget=native -E" BASECFLAGS="-xtarget=native" OPT="-xO5"

Re: CPython on the Web

2011-01-03 Thread MrJean1
FireFox 3.6.13 on MacOS X Tiger (10.4.11) fails: Error: too much recursion Error: Modules is not defined Source File: http://synthensity.com/static/python.html /Jean On Jan 2, 11:26 pm, Wolfgang Strobl wrote: > azakai : > > >On Jan 2, 4:58 pm, pyt...@bdurham.com wrote: > >> Azakai/Gerry,

Re: CPython on the Web

2011-01-03 Thread MrJean1
FYI, The example http://syntensity.com/static/python.html works fine in Safari 4.1.3 on MacOS X Tiger (10.4.11). /Jean On Jan 3, 5:59 pm, azakai wrote: > On Jan 3, 12:23 pm, Gerry Reno wrote: > > > > > > > On 01/03/2011 03:10 PM, azakai wrote: > > > > On Jan 2, 5:55 pm, Gerry Reno wrote:

Re: Completely Deleting A Directory

2010-04-26 Thread MrJean1
Two comments: 1) Should delete_dir not be called instead of os.rmdir in this line (os.rmdir, os.remove)[os.path.islink(item)](item) 2) Function rmtree in the shutil module considers symlinks to a directory an error since

Re: Completely Deleting A Directory

2010-04-26 Thread MrJean1
The answer to 1) is no, due to topdown = False in the call to os.walk. /Jean On Apr 26, 8:31 am, MrJean1 wrote: > Two comments: > > 1) Should delete_dir not be called instead of os.rmdir in this line > >                 (os.rmdir, os.remove)[os.path.islink(item)](item) > >

Re: What does this PyChecker warning mean?

2010-06-01 Thread MrJean1
Although PyChecker 0.8.18 is quite an improvement over previous releases, it does have quirks. The PyChecker postprocessor might be helpful, see /Jean On Jun 1, 4:48 am, Leo Breebaart wrote: > When fed the following code: > >  def Foo(): > >    

Re: Windows: How to detect whether a Python app/script is running in console/GUI mode?

2010-07-27 Thread MrJean1
On Jul 27, 8:36 am, Tim Golden wrote: > On 27/07/2010 15:58, Brian Curtin wrote: > > > On Tue, Jul 27, 2010 at 09:36,  wrote: > > >> Windows: How can I detect whether a Python app/script is running in > >> console/GUI mode? By app I mean a script compiled to an exe via py2exe or > >> similar. > >

Re: SimpleHTTPServer, external CSS, and Google Chrome

2010-09-17 Thread MrJean1
FWIW, There is a blue text on a red background in all 4 browsers Google Chrome 6.0.472.59, Safari 5.0.1 (7533.17.8), FireFox 3.6.9 and IE 6.0.2900.5512 with Python 2.7 serving that page on my Windows XP SP 3 machine. /Jean On Sep 16, 11:59 pm, Justin Ezequiel wrote: > I am running "python -

  1   2   >