Re: overriding __getitem__ for a subclass of dict

2009-11-15 Thread Christian Heimes
Steve Howell wrote: > Does anybody have any links that points to the rationale for ignoring > instance definitions of __getitem__ when new-style classes are > involved? I assume it has something to do with performance or > protecting us from our own mistakes? Most magic methods are implemented as

Re: WindowsError is not available on linux?

2009-11-18 Thread Christian Heimes
Dave Angel wrote: > Worse, even if the exception cannot be thrown on a non-Windows > environment, leaving it undefined makes it very awkward to write > portable code. An except clause that can never happen in a particular > environment is pretty innocent. Or somebody can use a base class for

Re: adding a directory to sys.path

2009-11-23 Thread Christian Heimes
John Guenther schrieb: > This is Mac related. I am running snow leopard. I am using Python 2.6.3. > > I had a lot of difficulty figuring out how to add a directory to sys.path > that would be there every time I launched Idle. I have a directory called > PythonPrograms in my Documents folder. Whe

Re: Relative versus absolute paths on Windows

2009-11-23 Thread Christian Heimes
Gregory Ewing wrote: > ntpath.join('d:\\foo', '\\bar') >> '\\bar' > > This does seem like a bug, though -- the correct result > should really be 'd:\\bar', since that's what you would > get if you used the name '\\bar' with 'd:' as your current > drive. No, it's not a bug. Since \bar is an ab

Re: Modules failing to add runtime library path info at link time

2010-02-01 Thread Christian Heimes
cjblaine wrote: > Where/how can I configure the appropriate portion of our Python > install to do 100% the right thing instead of just 50% (-L)? Python's distutils doesn't alter the library search path unless you tell it explicitly. > A specific example -- note the -L and lack of -R (Solaris buil

Re: Optimized bytecode in exec statement

2010-02-01 Thread Christian Heimes
Terry Reedy wrote: > Currently, as far as I know, -0 just removes asserts. -O (not -0) also sets __debug__ to False. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: new.instancemethod __iter__

2010-02-06 Thread Christian Heimes
Martin Drautzburg wrote: > The first case does what I expected, i.e. it iterates over whatever f() > yields. In the second case nothing is printed. I have the impression > that it still calls the original __iter__() method (the one defined at > the class level). > > Why is that so? > How can I repl

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Christian Heimes
duncan smith wrote: > Hello, >I'm trying to find a clean and reliable way of uncovering > information about 'extremal' values for floats on versions of Python > earlier than 2.6 (just 2.5 actually). I don't want to add a dependence > on 3rd party modules just for this purpose. e.g. For

Re: ANN: obfuscate

2010-02-08 Thread Christian Heimes
Steven D'Aprano schrieb: > I am pleased to announce the first public release of obfuscate 0.2.2a. > > http://pypi.python.org/pypi/obfuscate/0.2.2a > > obfuscate is a pure-Python module providing classical encryption > algorithms suitable for obfuscating and unobfuscating text. > > obfuscate inc

Re: ANN: obfuscate

2010-02-09 Thread Christian Heimes
Stef Mientki wrote: > sorry I don't, > unless Python is only meant for the very well educated people in encryption. All algorithms in obfuscate are obsolete, insecure and only interesting for people *that* want to get well educated in the history of encryption. > I neither did look at the code, >

Re: ANN: obfuscate

2010-02-11 Thread Christian Heimes
Gregory Ewing wrote: > Actually I gather it had a lot to do with the fact that > the Germans made some blunders in the way they used the > Enigma that seriously compromised its security. There > was reportedly a branch of the German forces that used > their Enigmas differently, avoiding those mista

Re: Bizarre arithmetic results

2010-02-11 Thread Christian Heimes
Terrence Cole wrote: -0.1 ** 0.1 > -0.7943282347242815 a = -0.1; b = 0.1 a ** b > (0.7554510437117542+0.2454609236416552j) -abs(a ** b) > -0.7943282347242815 > > Why does the literal version return the signed magnitude and the > variable version return a complex? The binary po

Re: python crash on windows but not on linux

2010-02-12 Thread Christian Heimes
hjebbers wrote: > The message on the screen is (I typed it over): > > ** > python.exe > > python.exe has encountered a problem and needs to close. > We are sorry for the inconvenience. > > If you were in the midd

Re: Python version of perl's "if (-T ..)" and "if (-B ...)"?

2010-02-12 Thread Christian Heimes
Lloyd Zusman wrote: > The -T and -B switches work as follows. The first block or so > of the file is examined for odd characters such as strange control > codes or characters with the high bit set. If too many strange > characters (>30%) are found, it's a -B file; otherwise it

Re: Please help with MemoryError

2010-02-12 Thread Christian Heimes
mk wrote: > Hmm how about "call by label-value"? Or "call by guido"? How do you like "call like a dutch"? :] -- http://mail.python.org/mailman/listinfo/python-list

Re: MemoryError, can I use more?

2010-02-12 Thread Christian Heimes
Echavarria Gregory, Maria Angelica wrote: > Dear group: > > I am developing a program using Python 2.5.4 in windows 32 OS. The amount of > data it works with is huge. I have managed to keep memory footprint low, but > have found that, independent of the physical RAM of the machine, python > alw

Re: Fighting with subprocess.Popen

2010-02-14 Thread Christian Heimes
Mr.John wrote: > Below is a test case that demonstrates this. Tests 1 & 2 concatenate the > command and the argument, Tests 3 & 4 mimic the python docs and use the form > Popen(["mycmd", "myarg"], ...), which never seems to work. It doesn't work with shell=True because the shell is not able to int

Re: killing own process in windows

2010-03-07 Thread Christian Heimes
News123 wrote: > Hi, > > > How can I kill my own process? > > Some multithreaded programs, that I have are unable to stop when ctrl-C > is pressed. > Some can't be stopped with sys.exit() You have to terminate the XMP-RPC server or the manager first. Check the docs! You can terminate a Python

Re: Use python and Jython together? (newbie)

2010-03-13 Thread Christian Heimes
Karjer Jdfjdf wrote: > I'm pretty new at programming and want some advice on mixing Jython and > Python. > > I want to use Jython to access some Java libraries, but I want to keep > developing in normal Python. Some modules I use a lot are not available in > Jython. > > The bulk of my programm

Re: How to add a library path to pythonpath ?

2010-03-16 Thread Christian Heimes
Steve Holden schrieb: > Barak, Ron wrote: >> Hi, >> >> I'm trying to add a library path to my pythonpath, but seems it is not >> accepted - >> >> On Windows DOS window: >> >> C:\>echo %PYTHONPATH% >> c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\ >> > That looks like it should work. The only t

Re: datetime string conversion error

2010-03-16 Thread Christian Heimes
Jordan Apgar wrote: > Hey all, > I'm trying to convert a string to a date time object and all my fields > convert except for month which seems to default to january. > > here's what I'm doing: > date = "2010-03-16 14:46:38.409137" > olddate = datetime.strptime(date,"%Y-%m-%j %H:%M:%S.%f") > > pr

Re: Structure accessible by attribute name or index

2010-03-17 Thread Christian Heimes
Wes Santee wrote: > I am very new to Python, and trying to figure out how to create an > object that has values that are accessible either by attribute name, > or by index. For example, the way os.stat() returns a stat_result or > pwd.getpwnam() returns a struct_passwd. > > In trying to figure it

Re: What Does sys.platform Return On 64 Bit Windows Systems?

2010-03-17 Thread Christian Heimes
Tim Daneliuk schrieb: > On older 32 bit Windows systems, sys.platform returns: 'win32' > > What does it return on 64-bit Windows systems? I'd check myself, but > I don't have access to 64-bit Windows. Do you want to know if the current build of Python is a 32 or 64bit build? >>> import struct

Re: How to automate accessor definition?

2010-03-21 Thread Christian Heimes
Steve Holden wrote: > You may well find that namedtuple is faster than what you put together > yourself, as the collections module is implemented in C. But namedtuple isn't, Steve. Namedtuple is a class generator that creates fast and efficient classes. -- http://mail.python.org/mailman/listinfo

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Christian Heimes
Martin P. Hellwig schrieb: > What I don't understand why in the second test, the last boolean is True > instead of (what I expect) False. > Could somebody enlighten me please as this has bitten me before and I am > confused by this behavior. Hint: TEST2.one is not a reference to TEST2.__instance

Re: Cannot Remove File: Device or resource busy

2010-11-17 Thread Christian Heimes
Am 17.11.2010 09:16, schrieb Brett Bowman: > Good ideas, but I've tried them already: > -No del command, or replacing it with a set-to-null, neither solve my file > access problem. > -PdfFileReader has no close() function, and causes an error. Weird, but > true. > -pdf_handle.close() on the other

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Christian Heimes
Am 03.12.2010 14:53, schrieb Jean-Michel Pichavant: > Next time I promise to look at the doc before actually asking the > question here :) You are misinterpreting the excerpt. You are right that the id of an object doesn't change during the lifetime of a Python process and as long as it stays ins

Re: kinterbasdb error connection

2010-12-07 Thread Christian Heimes
Am 07.12.2010 16:35, schrieb Ale Ghelfi: > (i'm under Ubuntu 10.10 amd64 and python 2.6 and kinterbasdb 3.2 ) > I try to connect my database of firebird 2.5 by kinterbasdb. > But python return this error : > > >>> c = > kinterbasdb.connect(dsn="/media/VINACCIA.FDB",user="user",password="password

Re: Python creates "locked" temp dir

2010-12-08 Thread Christian Heimes
Am 08.12.2010 19:05, schrieb astar: > Hi, > > I recently got caught on tempfiles with respect to > urllib.urlretrieve, which can create a tmpfile. Ah, but the file > simply could not be found on the file system, even as root. But > within the program that created the tmpfile, you could do usefu

Re: Python creates "locked" temp dir

2010-12-08 Thread Christian Heimes
Am 08.12.2010 10:31, schrieb Alex Willmer: > 2. When you say "I am unable to access". Do you mean another script/ > process is unable to access? If so, that is the point of mkdtemp() - > to make a temporary directory that _only_ the creating process can > access. If you want to share it then tempfi

Re: Making os.unlink() act like "rm -f"

2010-12-11 Thread Christian Heimes
Am 11.12.2010 18:04, schrieb Roy Smith: > if os.access("file", os.F_OK): >os.unlink("file") > > but that's annoying too. What would people think about a patch to > os.unlink() to add an optional second parameter which says to ignore > attempts to remove non-existent files (just like "rm -f"

Re: while True or while 1

2010-12-12 Thread Christian Heimes
Am 12.12.2010 15:14, schrieb Max Countryman: > I'm sure this has been brought up many times, but a quick Googling didn't > yield the decisive results I was hoping for, so I apologize if this has > already been addressed in great detail somewhere else. > > I am wondering what the rationale is beh

Re: while True or while 1

2010-12-12 Thread Christian Heimes
Am 12.12.2010 19:31, schrieb Steve Holden: > Would you care to quantify how much CPU time that optimization will > typically save for a loop of fair magnitude (say, a billion iterations)? The difference is minimal but measurable for very tight loops. $ python -m timeit -n20 -- "i = 0" "while 1:"

Re: How to install pycrypto mode in windows ?!

2010-12-13 Thread Christian Heimes
Am 13.12.2010 11:20, schrieb Darshak Bavishi: > Hi Experts , > > I am using python 2.6 and i had installed paramiko module which needs > pycrypto but , > when i am installing pycrypto in windows its giving error as follows: > [...] > can u suggest any source to get pycrypto to avoid such events?!

Re: Is there any way to SSH from Python ?!

2010-12-13 Thread Christian Heimes
Am 13.12.2010 12:41, schrieb Darshak Bavishi: > Hi, > > I have downloaded paramiko and installed it now it needs Pycrypto . So i > tried to install pycrypto but its giving error of vcvarsall.bat > so from christian suggestion i downloaded MinGW . But i have no idea how to > install it in windows m

Re: while True or while 1

2010-12-14 Thread Christian Heimes
Am 14.12.2010 17:52, schrieb Arnaud Delobelle: > You also need to initialise False to False for it to be really > robust. So something like this will do. > > True = not 0 > False = not True > while True: > ... > True = False Tres Seavers once told me a joke like this:

Re: True lists in python?

2010-12-19 Thread Christian Heimes
Am 19.12.2010 09:24, schrieb Paul Rubin: > Deques are not linked lists. They're just like regular Python lists > (i.e. resizeable arrays) except they can grow and shrink at both ends > rather than just one. The amortized complexity of an append or pop > operation (at either end) is O(1) but occas

Re: How can I intentionally crash my lappy?

2010-12-20 Thread Christian Heimes
Am 20.12.2010 09:45, schrieb mechtheist: > I am no programmer, but know the rudiments [the rudi'est of rudiments] > of working with Python. I have a simple need, to have a simple > script/app I can run that will crash my PC. On my desktops, I can > always hit the reset, but that is not an opt

Re: __delitem__ "feature"

2010-12-26 Thread Christian Heimes
Am 26.12.2010 18:53, schrieb kj: > It means that, for both subclasses, del fails to trigger the > dynamically installed instance method __delitem__. Magic methods like __delitem__ are looked up on the type, not on the instance. You can't change the behaviour on instances. > If I replace dict with

Re: __delitem__ "feature"

2010-12-26 Thread Christian Heimes
Am 26.12.2010 19:49, schrieb kj: > How do you know this? Is this documented? Or is this a case of > Monday-night quarterbacking? Please stop bitching around. You know that by carefully reading the documentation: http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-

Re: Interning own classes like strings for speed and size?

2010-12-28 Thread Christian Heimes
Am 28.12.2010 15:11, schrieb Steven D'Aprano: > # Untested > class InternedTuple(tuple): > _cache = {} > def __new__(cls, *args): > t = super().__new__(cls, *args) > return cls._cache.setdefault(args, t) > def __eq__(self, other): > return self is other > de

Re: Interning own classes like strings for speed and size?

2010-12-28 Thread Christian Heimes
Am 28.12.2010 21:16, schrieb Hrvoje Niksic: > Christian Heimes writes: > >> Also this code is going to use much more memory than an ordinary tuple >> since every instance of InternedTuple has a __dict__ attribute. This >> code works but I had to move the cache outs

Re: A and B but not C in list

2011-01-23 Thread Christian Heimes
Am 23.01.2011 22:05, schrieb CM: > In Python, is there a recommended way to write conditionals of the > form: > > "if A and B but not C or D in my list, do something." ? > > I may also have variations on this, like "if A but not B, C, or D". > > Do I have to just write out all the if and elifs

Re: A and B but not C in list

2011-01-24 Thread Christian Heimes
Am 24.01.2011 04:05, schrieb Ian Kelly: > On Sun, Jan 23, 2011 at 2:34 PM, Christian Heimes wrote: >> your_set = set(your_list) >> >> if your_set.issuperset(set([A, B])) and your_set.isdisjoint(set([C, D])): > > if your_set.intersection([A, B, C, D]) == set([A, B]

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread Christian Heimes
Am 14.02.2011 00:12, schrieb rantingrick: > False! There IS harm in using super when super not needed. The > difference is readability! And don't downplay that aspect. You > yourself have said this in the past. It seems *some* of us have very > short memories. Of course you are entitled to have yo

Re: Loading an imported module (C API)

2010-04-08 Thread Christian Heimes
On 06.04.2010 15:58, booncw wrote: Hi, I am running a simulation where the python module has already been imported. Could you please tell me how to load it? I've been doing this (importing everytime), but it is too slow: pModule = PyImport_Import(pName); You can cache the module object in a

Re: msvcr90.dll is MIA?

2010-04-14 Thread Christian Heimes
On 14.04.2010 13:22, Alex Hall wrote: I tried both vcredist_x86.exe and vcredist_x64.exe, with no result; I still do not have the required dll (I have 32-bit python, so the _x86 should have done the trick). I will try another poster's suggestion of installing vcpp express 2005 and hope that will

Re: msvcr90.dll is MIA?

2010-04-14 Thread Christian Heimes
On 14.04.2010 14:25, Alex Hall wrote: I notice that I do not have the dll when py2exe says it cannot locate the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does not seem to give me the dll, but the py2exe tutorial says that it will. What am I missing? Do you have the correct v

Re: How to check what is holding reference to object

2010-04-28 Thread Christian Heimes
Almar Klein wrote: Ah, it does exist! I wish I knew that two months ago, it would've saved me some precious time ;) The trick works only for objects that are tracked by CPython's garbage collector. Simple and non-containerish objects like str, int, unicode and some other types aren't tracked

Re: using python2.6 on windows without installation

2010-04-29 Thread Christian Heimes
Mirko Vogt wrote: Hey, is there a way to use python2.6 without having used the installation routine? When I install python2.6 and copy over the python-directory (C:\programs \python2.6) to another windows host and trying to execute python.exe there, I get an error that python26.dll could not be

Re: matching strings in a large set of strings

2010-04-30 Thread Christian Heimes
s = "12345678901234" assert len(s) == 14 import sys sys.getsizeof(s) 38 So a single 14 char string takes 38 bytes. Make that at least 40 bytes. You have to take memory alignment into account. So a set with 83000 such strings takes approximately 1 MB. So far fairly trivial. But that's just th

Re: List size versus list allocation

2010-05-02 Thread Christian Heimes
I'm interested in gathering some statistics on this, and to do so I need a way of measuring the list's logical size versus its actual size. The first is easy: it's just len(list). Is there some way of getting the allocated size of the list? With Python 2.6 and newer you can use sys.getsizeof() t

Re: duplicate temporary file?

2010-05-03 Thread Christian Heimes
Laszlo Nagy wrote: However, it won't work for temporary files. Temporary files are just file-like objects, and their name is ''. I guess I could open a temporary file with os.open, and then use os.dup, but that is low level stuff. Then I have to use os.* methods, and the file object won't be iter

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Christian Heimes
pyt...@bdurham.com wrote: Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? I need to cache some overflow data to disk in a temp file and I want to make sure no other processes can read the contents of this file while I'm using it. I tri

Re: Create a new process to run python function

2010-05-05 Thread Christian Heimes
Joe Riopel wrote: On Wed, May 5, 2010 at 8:56 AM, Massi wrote: but this does not work, since the two threads share the same pid. Can anyone give me a suggestion? Have you looked at os.fork ? http://docs.python.org/library/os.html#os.fork Fork on Windows XP? Have a lot of fun ... The NT Kern

Re: Create a new process to run python function

2010-05-05 Thread Christian Heimes
Am 05.05.2010 17:59, schrieb Benjamin Kaplan: Multiprocessing wasn't added until Python 2.6. http://www.python.org/dev/peps/pep-0371/ In Python 2.5, it was still a 3rd party package. http://pypi.python.org/pypi/processing The project's website appears to be down right now though. http://develop

Re: Where is python31.dll?

2010-05-05 Thread Christian Heimes
Am 05.05.2010 19:26, schrieb Pietro Campesato: Hi, recently I've been wondering how to roll my own portable python 3.1 (since there seems to be no portable app specifically for this version). Thinking you can just copy your install folder (+ python's dll), I've noticed that there seems to be no p

Re: Difference between 'is not' and '!=' ?

2010-05-10 Thread Christian Heimes
AON LAZIO wrote: As subject says, what is the differences of 'is not' and '!='. Confusing.. "is not" checks if two objects are not identical. "!=" checks if two objects are not equal. Example: Two apples may be equal in size, form and color but they can never be identical because they are m

Re: open(False) in python3

2010-05-12 Thread Christian Heimes
Johan Förberg every: That's interesting. Are there any more numbered pseudofiles? I suppose its mainly an excellent way to confuse people when you open(0).read(), but it would be interesting to know. All opened files (and on Unix even network sockets, epoll queues, inotify handlers etc) have a

Re: A couple questions about classes and inheritance

2010-05-16 Thread Christian Heimes
First, I've looked a fair bit and can't find how one can find the base classes of a subclass? isinstance and issubclass sort of do the opposite of what I want. Surely somewhere there is something like MyThingee.something.orOther.baseClasses() You can get the direct parents of a class with the

Re: Classes and threading

2010-05-19 Thread Christian Heimes
Or if you do need to override it for some reason, you need to accept the extra args and pass them on: class nThread(threading.Thread): def __init__(self, *args, **kwds): threading.Thread.__init__(self, *args, **kwds) # your other stuff here Since Thread is a

Re: Loading C extension from memory

2010-05-19 Thread Christian Heimes
mk wrote: I wonder if there is a way to load C extension from in-memory object, not from the file on the disk? No, that's not possible since Python depends on the operating system. A lot of operating systems require a physical file to load the shared library from. Python uses dlopen() on most

Re: Strange MySQL Problem

2010-05-20 Thread Christian Heimes
MRAB wrote: I think you need to 'commit' any changes to do to the database. Yeah, you are right. Also some RDBMS don't support DDL and DML statements inside one transaction. You may need to commit and begin after the create table DDL. Christian -- http://mail.python.org/mailman/listinfo/pyt

Re: optional argument to a subclass of a class

2010-05-21 Thread Christian Heimes
Am 21.05.2010 04:56, schrieb Alex Hall: Hi all, I am now trying to allow my classes, all of which subclass a single class (if that is the term), to provide optional arguments. Here is some of my code: class Craft(): def __init__(self, name, isAircraft=False, id=helpers.id(), hits=0,

Re: creating addon system

2010-05-22 Thread Christian Heimes
Am 22.05.2010 12:06, schrieb timo verbeek: Is there not an other way to create a fast addon system? A module or something like that How fancy are your requirements? People have written numerous plugin systems, from simple to use ones like CherryPy's tool system up to a complex component archi

Re: Just To Be Sure...MySQL

2010-05-22 Thread Christian Heimes
A lister recently responded to my post concerning mysl commands of the following type: cursor.execute('insert into foo values (%s, %s)' % (bar, something)) stating that I need to eliminate the "%" to prevent injection attacks, thus: cursor.execute('insert into foo values (%s, %s)', (bar, someth

Re: Just To Be Sure...MySQL

2010-05-22 Thread Christian Heimes
Am 22.05.2010 18:09, schrieb Adam Tauno Williams: On Sat, 2010-05-22 at 18:06 +0200, Christian Heimes wrote: A lister recently responded to my post concerning mysl commands of the following type: cursor.execute('insert into foo values (%s, %s)' % (bar, something)) stating that

Re: Another Little MySQL Problem

2010-05-26 Thread Christian Heimes
Actually, no. The names of tables are not quoted in SQL. One writes SELECT ID FROM mytable; not SELECT ID FROM "mytable"; nit picking mode: Some RDBMS support case sensitive table names. You have to quote the table name if you using the feature. Yeah I know, it's prett

Re: Minor annoyances with properties

2010-05-27 Thread Christian Heimes
Do I miss something? Is this the way to do it, or is there a better one? A better way was introduced in Python 2.6. See http://docs.python.org/library/functions.html?highlight=property#property I have a Python only version around if you are still using Python 2.5. Christian -- http://mail.p

Re: dbf files and indexes

2010-05-27 Thread Christian Heimes
Finally, are these SQL databases? The best way of getting information is with SQL. SELECT * FROM NumberOfPets WHERE name IN (SELECT name FROM CatLovers) OR name IN (SELECT name FROM DogLovers) ORDER BY name; A good way is to use SQL with JOINs instead of horrible nested selects. Although S

Re: Minor annoyances with properties

2010-05-28 Thread Christian Heimes
Am 28.05.2010 11:31, schrieb eb303: > On May 27, 3:24 pm, Christian Heimes wrote: >>> Do I miss something? >>> Is this the way to do it, or is there a better one? >> >> A better way was introduced in Python 2.6. >> Seehttp://docs.python.org/library/functio

Re: signed vs unsigned int

2010-06-02 Thread Christian Heimes
> i'm reading bytes from a serial port, and storing it into an array. > > each byte represents a signed 8-bit int. > > currently, the code i'm looking at converts them to an unsigned int by > doing ord(array[i]). however, what i'd like is to get the _signed_ > integer value. whats the easiest way

Re: Windows and My Documents

2010-06-03 Thread Christian Heimes
> You're asking, it seems, for the equivalent of a UNIX softlink... > Normal Windows doesn't support those (I think they are in the OS > somewhere but not made visible to the user). Actually NTFS supports hard links, soft links and junction points since Windows 2k. [1] Christian [1] http:/

Re: Missing DLL in win98

2010-06-04 Thread Christian Heimes
Am 04.06.2010 14:38, schrieb Spyder42: > I hope this is the right place to ask this, and appologise if it's > not. I'm trying to install 2.6.5 in Win98 se final. It says "a > required dll could not be run". Do I have to upgrade my whole OS just > to install this, or is there a fix I can apply to 98

Re: Missing DLL in win98

2010-06-04 Thread Christian Heimes
> So your response is either, you don't know if there is a fix, or 'No > way in h377.' You couldn't figure out by my post that I already knew > that? Let me paraphrase my answer: You can't run Python 2.6 on Windows 98 because we have dropped support for any Windows older than Windows 2000 SP4. I

Re: passing environment variable path to open command

2010-06-11 Thread Christian Heimes
Am 11.06.2010 10:39, schrieb Mahmood Naderan: > Hi, > I am new to python so my question may be very basic. > Suppose I have a file (sc_1.sh) which the path to that file is in system path: > SOMETHING=/home/mahmood/scripts > > Now I want to open that file with respect to the environment variable:

Re: Overriding "__setattr__" of a module - possible?

2010-06-16 Thread Christian Heimes
> There aren't any; modules do not follow the class object protocol. They > are simple types with a __dict__ (which you can't change, either, so no > replacing it with a dict that implements __setattr__). You are wrong, my friend. :) Modules follow the new style class and instance protocol. Modul

Re: setup server from scratch (with or without apache?)

2010-06-21 Thread Christian Heimes
> I will only have one IP address and only port 443. > > 1.) What alternatives would exist compared to apache / mod_python You can use a combination of mod_proxy and mod_rewrite to set up a forwarding proxy in your Apache server. Let Apache deal with SSL, virtual hosting etc. Then bind your appli

Re: adding new function

2010-06-23 Thread Christian Heimes
Am 22.06.2010 19:18, schrieb Terry Reedy: > On 6/22/2010 5:44 AM, Daniel Fetchinson wrote: >>> how can i simply add new functions to module after its initialization >>> (Py_InitModule())? I'm missing something like >>> PyModule_AddCFunction(). > > in Python, for modules written in python > > imp

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Christian Heimes
> The InstanceCounted.count is 1 at the end. If I omit the call to > "self.method = print_exception_decorator(self.method)" then the instance > count goes down to 0 as desired. I thought that the decorator might be > holding a reference to the instance through the bound method, so I added > t

Re: Problem PIL-1.1.7 & _imagingft

2010-06-24 Thread Christian Heimes
Am 24.06.2010 14:39, schrieb Michel Claveau - MVP: > Hi! > > With PIL-1.1.7.win32-py2.6 and Windows 7, I have this traceback: > raise ImportError("The _imagingft C module is not installed") > ImportError: The _imagingft C module is not installed > > I tested "import _imaging" and several othe

Re: GDAL-1.7.1 : vcvarsall.bat missing

2010-06-24 Thread Christian Heimes
> I am attempting to install the GDAL bindings (GDAL-1.7.1) on a > Windows XP Desktop with Python 2.6 and GDAL. During install, the > script finishes with "error: Unable to find vcvarsall.bat". > > What dependencies am I missing? Visual Studio 2008 Christian -- http://mail.python.org/mailman/

Re: GDAL-1.7.1 : vcvarsall.bat missing

2010-06-25 Thread Christian Heimes
> I'll try my luck with Cygwin's ggc before I look into another C/C++ > compiler. Better grab a recent build of MinGW32. Python's build system has native support for mingw32. IIRC Cygwin's GCC is only supported for Cygwin builds of Python. Christian -- http://mail.python.org/mailman/listinfo/p

Re: I strongly dislike Python 3

2010-06-26 Thread Christian Heimes
Am 26.06.2010 17:59, schrieb Stefan Reich: > The main problem is that Python 3 is incompatible with almost all > scripts written for Python 2 (if they use print). And it gets worse: > Python 3 scripts are incompatible with Python 2! (If they use print > variants, like writing to a file.) Seems

Re: dynamically modify help text

2010-06-28 Thread Christian Heimes
> >>> i.__add__ = __add__ > >>> i+1 > 6 > >>> > > Was this in reference to a specific python version? This doesn't work with new style classes and thus not in Python 3.x. Subclass from object and you'll see the difference. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: pyc runtime error

2010-06-30 Thread Christian Heimes
> Actually i wrote some scripts in python that are working as gateway > controlling scripts iptables/tc/squid-proxy, and i want to execute > them as cgi. Protection of source code is also important. These > scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to > eleminate this execution e

Re: Python 2.4.2 Installation error

2010-07-01 Thread Christian Heimes
> I'm using Ubuntu 10.04, i try to install Python 2.4.2 & Python 2.4.3 got > error message while doing make command. anybody can tell tell, How to > overcome this error Perhaps somebody is able to help you if you provide the full error message and describe all steps that lead to the error mesa

Re: python ctypes to int main(int argc, char *argv[])

2010-07-01 Thread Christian Heimes
> my question is, therefore, how do i specify a ctypes wrapper around > the standard int main(int argc, char *argv[]) which i am (obviously) > going to move to a (new) c library? Maybe I missing something here but libraries don't have a main() function. The main() function is the entry point of a

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Christian Heimes
Am 06.07.2010 18:21, schrieb Thomas Jollans: > mingw gcc should work for building C++ extensions if it also works for C > extensions. There's no difference on the binding side - you simply have > to include everything as extern "C", which I am sure the header does for > you. You need unofficial ve

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Christian Heimes
>> You need unofficial version of MinGW with gcc 4.x for several C++ >> extension like PyLucene's JCC. Some project like pywin32 don't work with >> MinGW, too. > > aha - why is that? > > But - if you write code that builds with [whatever gcc version you > have], the compiler Python is built with

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Christian Heimes
> That's nice to know, but I personally don't have an MSDN subscription. > Many scientists don't have access to development tools like VS2008. > Many hobby developers don't have access expensive MSDN subscriptions. > Many don't develop C personally, but just "needs a compiler" to build > an extensi

Re: Python -- floating point arithmetic

2010-07-07 Thread Christian Heimes
> can anybody tell me how python internal represent a float number?? It's an IEEE 754 double precision float on all hardware platforms that support IEEE 754 semantics. Python follows the C99 standards for double and complex numbers. Christian -- http://mail.python.org/mailman/listinfo/python-li

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Christian Heimes
> Yeah, but then we're down to file descriptors, C library locales and such as > the > remaining problems. Don't forget errno! Every CRT might have its own errno thread local. I don't know how its handled on Windows but I suspect it suffers from the same problem. Christia -- http://mail.pytho

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-07 Thread Christian Heimes
> The main problem that the required MSVC redistributables are not necessarily > present on the end user's system. It's not a problem for Python anymore. It took a while to sort all problems out. Martin and other developers have successfully figured out how to install the CRT for system wide and

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-08 Thread Christian Heimes
> Really? I wasn't entirely aware of this effect of the "io" module. > Somehow, without at all paying attention (because certain third party > modules blocking me for awhile, I never looked close enough), I just > sort of thought the "io" module was mostly thin wrappers around stdio > primitives, i

Re: Debugging a segmentation fault

2010-07-08 Thread Christian Heimes
> my python project crashes in a non reproducible way. With gdb I got > the backtraces given below. > How can I possibly figure out the reason for the segfaults that occur > under Linux and Windows, using Python 2.6 in both cases. One of your third party C extension has a reference count bug. It l

Re: Why there is no "setdefaultencoding" in sys module?

2010-07-09 Thread Christian Heimes
> oh, I take back my words, it's still there, just I need to > reload(sys). Just don't. If you change the default encoding you are going to break important data structures like dicts in a subtle and hard to detect way. If your application needs to change the default encoding, it's broken. The func

Re: zipimport (.pyd & .so) files.

2010-07-09 Thread Christian Heimes
> It's strictly for windows platform. I would like to know from expert > python users and linux programmers, how we can achieve similar > functionality on linux platform? I do have limited c/c++ skill sets > but I would love to give a try. I don't know any way to load a shared library from somethi

Re: any issues with long running python apps?

2010-07-09 Thread Christian Heimes
> but none of this has anything to do with Python itself. i am sure python > servers have been running reliably for long periods of time, but i've > never had to deal with a two-month guarantee before. is there something > else i am missing here that i should be concerned about on the > pure-P

Re: Web page special characters encoding

2010-07-10 Thread Christian Heimes
> Hi all, I'm using py3k and the urllib package to download web pages. Can > you suggest me a package that can translate reserved characters in html > like "è", "ò", "é" in the corresponding correct > encoding? I think the html parser of LXML can convert the entities, too. Christian -- http:

<    4   5   6   7   8   9   10   11   >