Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
On Sep 9, 7:45 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > ago wrote: > > The only thing I would add is that in my experience I often use > > different working-envs for different projects, so I'd prefer to have a > > more generic solution as opposed to a

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
Small variation on the above patch, using 2 environment variables: PYTHONSITEDIR allows for local site-packages (that override system site packages), and PYTHONNOSYSSITES skips system site-packages for "clean-room" operation (similar to virtual-python.py --no-site- packages). --- /usr/lib/python2

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
On Sep 9, 6:56 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > I had a similar idea, wrote a PEP and implemented it for 2.6 and 3.0: > > http://www.python.org/dev/peps/pep-0370/ > > Christian Christian, I like your pep :), The only thing I would add is that in my experience I often use differ

PYTHONSITEDIR environment variable

2008-09-09 Thread ago
Dear all, These days I often find myself using working-env.py, virtual-python.py & co. The main reason in most cases is to insulate my working environment so that I can use custom site-package libs together with the default stdlib. PYTHONHOME and/or PYTHONPATH (particularly with python -S) get clo

Generalizing PEP 370 (per user site-packages directory) via .pth files

2008-03-19 Thread ago
ironments where there is a clear separation between IT and developer roles. I just started giving some thoughts to the concept and I am not fully aware of the implications and requirements of the proposal, but even if the above turns out to be impractical, I hope that a debate on the topic will be b

enum 0.4.1 not pickle-firendly

2006-07-19 Thread ago
I have started using the enum module () , at them moment pickling an object instance that has an EnumValues assigned to one of its attributes pickles the full enumeration, this is not efficient. I am not sure what is the best way around (I do not like the idea of having to use __getstate__/__setsta

Re: Very nice python IDE (windows only)

2006-06-07 Thread ago
Bernard Lebel wrote: > Not me. I'll probably sound pedantic but > - the editor text looks awful, changing the editor options had no effect at > all > - there is no network access of UNC paths other than through File > > Open and Python Paths. all of my code is on a network location > - expand

Re: Matplotlib 0.87.2 incompatible with numpy 0.9.8

2006-06-07 Thread ago
ago wrote: > I was not able to make matplotlib 0.87.2 work with numpy 0.9.8 (there > is an error in multiarray.pyd that crashes python). I have noticed that > there is a new version 0.87.3, but I was waiting for the windows > egg/exe version for python 2.4. I tried to compile from

Matplotlib 0.87.2 incompatible with numpy 0.9.8

2006-06-07 Thread ago
I was not able to make matplotlib 0.87.2 work with numpy 0.9.8 (there is an error in multiarray.pyd that crashes python). I have noticed that there is a new version 0.87.3, but I was waiting for the windows egg/exe version for python 2.4. I tried to compile from sources with little luck. Does the v

Very nice python IDE (windows only)

2006-06-07 Thread ago
I have just discovered Python Scripter by Kiriakos Vlahos and it was a pleasant surprise. I thought that it deserved to be signalled. It is slim and fairly fast, with embedded graphical debugger, class browser, file browser... If you are into graphical IDEs you are probably going to enjoy it. Windo

Re: win32com: how to connect to a specific instance of a running object?

2006-06-02 Thread ago
solved, if it can be useful to others here is my code: import pythoncom import win32com.client def getWorkbook(workbookName): lenstr = len(workbookName) workbook = None rot = pythoncom.GetRunningObjectTable() rotenum = rot.EnumRunning() while True:

Re: win32com: how to connect to a specific instance of a running object?

2006-06-02 Thread ago
The other approach I tried (as suggested by Tim, thanks) involves browsing the ROT. import pythoncom SPREADSHEET_NAME = r'\MySpreadsheet.xls' lenstr = len(SPREADSHEET_NAME) obj = None rot = pythoncom.GetRunningObjectTable() rotenum = rot.EnumRunning() while True: monikers = rotenum.Next()

Re: win32com: how to connect to a specific instance of a running object?

2006-06-02 Thread ago
Thanks, after some further digging I hit something... The following seems to do the trick: import win32gui WINDOW_CLASS = 'XLMAIN' WINDOW_TITLE = 'Microsoft Excel - MySpreadsheet.xls' hwindow = win32gui.FindWindow(WINDOW_CLASS,WINDOW_TITLE) Now the next question is: how do I use the window-handle

win32com: how to connect to a specific instance of a running object?

2006-06-01 Thread ago
Is it possible to use win32com.client to connect to a specific instance of a running application? In particular I am interested in finding the instance of excel which has a particular spreadsheet opened considering that there might be more instances of excel running at the same time. I need to take

Re: Scipy: vectorized function does not take scalars as arguments

2006-05-25 Thread ago
I have installed numpy-0.9.6 I haven't tried 0.9.8. -- http://mail.python.org/mailman/listinfo/python-list

Scipy: vectorized function does not take scalars as arguments

2006-05-24 Thread ago
Once I vectorize a function it does not acccept scalars anymore. Es def f(x): return x*2 vf = vectorize(f) print vf(2) AttributeError: 'int' object has no attribute 'astype' Is this the intended behaviour? -- http://mail.python.org/mailman/listinfo/python-list

How do I set the __debug__ flag in a win32com server?

2006-04-25 Thread ago
Hi all, When I use my win32com.server object from an excel client, the python process running the server always has __debug__==True. When using a python client the __debug__ flag for the server is determined by the client (i.e. if I start the client with 'python -o client.py' then __debug__ == Fal

Re: win32com: error 80004005

2006-03-28 Thread ago
I solved it. If someone else is in the same situation... It was due to a defective installation. I reinstalled python and pywin, re-registered the server and everything worked well. -- http://mail.python.org/mailman/listinfo/python-list

win32com: error 80004005

2006-03-27 Thread ago
ommandLine(HelloClass) ### PYTHON CLIENT (WORKS) ### import win32com.client obj = win32com.client.Dispatch('Python.HelloHello') print obj.Hello() ### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObject") ### Public Sub test() Dim obj As Object Set obj = CreateObject("Python.HelloHello") MsgBox obj.Hello("ago") End Sub -- http://mail.python.org/mailman/listinfo/python-list

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
> Do you think it is possible to reduce the set of all possible solutions > to a small enough set? I personally doubt it, but IF that was the case > an efficient solver could be easily created. To expand on the concept, assume for the argument sake that the universe of possible solutions can be re

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
>Your reduction-first approach makes short work of > them, though. On the other hand, my version probably didn't take as long > to write! Well, I started from the reduction-only algorithm so by the time I implemented the brute force solver I already had the code. Anyway the full code is just above

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
Anton, Do you think it is possible to reduce the set of all possible solutions to a small enough set? I personally doubt it, but IF that was the case an efficient solver could be easily created. In reducing the set of all solutions for instance you could always swap the numbers (3rd axis) so that

Re: Sudoku solver: reduction + brute force

2006-01-17 Thread ago
> But to inflate my ego beyond the known universe, here is my solver > (that solves the avove mentioned grid reasonably fast). I suppose the > only difference is that is uses 3, rather than 2, rules to simplify > before starting tree-like search. Thanks for the nice problem and the nice post. Th

Sudoku solver: reduction + brute force

2006-01-13 Thread ago
Inspired by some recent readings on LinuxJournal and an ASPN recipe, I decided to revamp my old python hack... The new code is a combination of (2) reduction methods and brute force and it is quite faster than the ASPN program. If anyone is interested I attached the code in http://agolb.blogspot.co

Re: Object default value

2005-09-20 Thread ago
In fact even IF I could get a default value to work as mentioned, then I would be creating potential name conflicts between the DataAttribute.DefaultValue and the other metadata. I.e. when calling obj.attr.x I could refer to DataAttribute.x or DataAttribute.value.x. It's a no go. -- http://mail.p

Re: Object default value

2005-09-20 Thread ago
> Is it safe to assume that the OP's next question will be how to invoke functions without the ()'s? To save you the trouble, then answer is 'no'. You probably nailed it, thanks for the answer. I suspected that was the case. I think I'll use __call__ + __set__ -- http://mail.python.org/mailman/

Re: Object default value

2005-09-20 Thread ago
I am trying to write a generic DataAttribute class in order to simplify access to object attributes and attached attribute-metadata for end users with little programming experience. Requirement 1: accessing the "default" value should be easy (using assignment operator, via descriptors like __get__

Re: Object default value

2005-09-20 Thread ago
The print statement was only for illustrative purposes, when calling varx=myobj I need to receive obj.x as opposed to the instance of obj, but I also need to call vary=myobj.y. Something like that exists for com objects/VB, for instance an excel range object uses value as the default attribute, so

Object default value

2005-09-20 Thread ago
Is it possible to have a default value associated python objects? I.e. to flag an attribute in such a way that the assignment operator for the object returns the default attribute instead of the object itself, but calls to other object attributes are properly resolved? (I don't think so, but I am n