Installing a binary package on virtualenv on windows

2012-04-04 Thread Manu
Hi
  I have been using virtualenv on my windows desktop for quite a while
now and would really recommend everyone to use it.
  Something I come across is how can I install a binary dependency  in
my virtual environment . I need to install lxml and gevent. Both
packages are delivered as windows installer (and not always the latest
version !!!) and it seems that pip install will not make the job( as
it will go through the build process...)

Thanks for your help.
M
-- 
http://mail.python.org/mailman/listinfo/python-list


ResponseNotReady in httplib

2012-03-28 Thread Manu
Hi
  I try to access a web site and it returns me this exception
"ResponseNotReady"  . I don't know what is the root of the problem and
how to sort it out.
I am using the excellent python requests library to access the web
site but it relies on httplib utlimately.


Could someone one explains me the problem and how to sort it out .

Thx
Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: max(), sum(), next()

2008-09-06 Thread Manu Hack
On Sat, Sep 6, 2008 at 12:57 AM, castironpi <[EMAIL PROTECTED]> wrote:
> On Sep 5, 9:20 pm, "Manu Hack" <[EMAIL PROTECTED]> wrote:
>> On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote:
>> > On Sep 5, 3:28 am, "Manu Hack" <[EMAIL PROTECTED]> wrote:
>> >> On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote:
>> >> > On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote:
>> >> >> David C. Ullrich:
>>
>> >> >> > At least in mathematics, the sum of the elements of
>> >> >> > the empty set _is_ 0, while the maximum element of the
>> >> >> > empty set is undefined.
>>
>> >> >> What do you think about my idea of adding that 'default' argument to
>> >> >> the max()/min() functions?
>>
>> >> >> Bye,
>> >> >> bearophile
>>
>> >> > For max and min, why can't you just add your argument to the set
>> >> > itself?
>>
>> >> > The reason max([]) is undefined is that max( S ) is in S.
>>
>> >> It makes sense.
>>
>> >> >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0.
>>
>> >> It doesn't make sense to me.  What do you set x to?
>>
>> > For all x.
>>
>> But then how can you conclude sum([]) = 0 from there?  It's way far
>> from obvious.
>
> You can define sum([a1,a2,...,aN]) recursively as
> sum([a1,a2,...a(N-1)])+aN.  Call the sum sum([a1,a2,...,aN]) "X", then
> subtract aN.
>
> sum([a1,a2,...a(N-1)])+aN=X
> sum([a1,a2,...a(N-1)])+aN-aN=X-aN
>
> For N=2, we have:
>
> sum([a1,a2])=X
> sum([a1,a2])-a2=X-a2
> sum([a1,a2])-a2-a1=X-a2-a1
>
> Since X= a1+ a2, replace X.
>
> sum([a1,a2])-a2-a1=(a1+a2)-a2-a1
>
> Or,
>
> sum([a1,a2])-a2-a1=0
>
> Apply the recursive definition:
>
> sum([a1])+a2-a2-a1=0
>
> And again:
>
> sum([])+a1+a2-a2-a1=0
>
> And we have:
>
> sum([])=0.

It makes more sense now, I just wanted to point out that only with
sum([x]) = x, you can't get sum([]) = 0.
--
http://mail.python.org/mailman/listinfo/python-list


Re: max(), sum(), next()

2008-09-05 Thread Manu Hack
On Fri, Sep 5, 2008 at 11:45 PM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Fri, 05 Sep 2008 22:20:06 -0400, Manu Hack wrote:
>
>> On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote:
> ...
>>>> >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0.
>>>>
>>>> It doesn't make sense to me.  What do you set x to?
>>>
>>> For all x.
>>
>> But then how can you conclude sum([]) = 0 from there?  It's way far from
>> obvious.
>
> I think Castironpi's reasoning is to imagine taking sum([x])-x for *any*
> possible x (where subtraction and addition is defined). Naturally you
> always get 0.
>
> Now replace x by *nothing at all* and you get:
>
> sum([]) "subtract nothing at all" = 0
>
> I think that this is a reasonable way to *informally* think about the
> question, but it's not mathematically sound, because if you replace x
> with "nothing at all" you either get:
>
> sum([]) - = 0
>
> which is invalid (only one operand to the subtraction operator), or you
> get:
>
> sum([0]) - 0 = 0
>
> which doesn't involve an empty list. What castironpi seems to be doing is
> replacing "nothing at all" with, er, nothing at all in one place, and
> zero in the other. And that's what makes it unsound and only suitable as
> an informal argument.

Actually it's even more natural to state sum([x]) = x, and this way
you can never conclude that sum([]) = 0 from there.
--
http://mail.python.org/mailman/listinfo/python-list


Re: max(), sum(), next()

2008-09-05 Thread Manu Hack
On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote:
> On Sep 5, 3:28 am, "Manu Hack" <[EMAIL PROTECTED]> wrote:
>> On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote:
>> > On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote:
>> >> David C. Ullrich:
>>
>> >> > At least in mathematics, the sum of the elements of
>> >> > the empty set _is_ 0, while the maximum element of the
>> >> > empty set is undefined.
>>
>> >> What do you think about my idea of adding that 'default' argument to
>> >> the max()/min() functions?
>>
>> >> Bye,
>> >> bearophile
>>
>> > For max and min, why can't you just add your argument to the set
>> > itself?
>>
>> > The reason max([]) is undefined is that max( S ) is in S.
>>
>> It makes sense.
>>
>> >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0.
>>
>> It doesn't make sense to me.  What do you set x to?
>
> For all x.

But then how can you conclude sum([]) = 0 from there?  It's way far
from obvious.
--
http://mail.python.org/mailman/listinfo/python-list


Re: max(), sum(), next()

2008-09-05 Thread Manu Hack
On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote:
> On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote:
>> David C. Ullrich:
>>
>> > At least in mathematics, the sum of the elements of
>> > the empty set _is_ 0, while the maximum element of the
>> > empty set is undefined.
>>
>> What do you think about my idea of adding that 'default' argument to
>> the max()/min() functions?
>>
>> Bye,
>> bearophile
>
> For max and min, why can't you just add your argument to the set
> itself?
>
> The reason max([]) is undefined is that max( S ) is in S.

It makes sense.

>The reason sum([]) is 0 is that sum( [ x ] ) - x = 0.

It doesn't make sense to me.  What do you set x to?
--
http://mail.python.org/mailman/listinfo/python-list


Re: fromfile error on windows, not mac

2008-07-23 Thread Manu Hack
On Wed, Jul 23, 2008 at 3:37 PM, jadamwil <[EMAIL PROTECTED]> wrote:

> I found the problem: I thought it was opening in binary mode on BOTH
> windows and the mac, but on windows I passed "rb" with double quotes,
> not 'rb' with single quotes to the open file function. Changing it to
> 'rb' fixed it.
>
>

by the way, anyone could explain why changing to single quote makes a
difference?

>>> "rb" == 'rb'
True
--
http://mail.python.org/mailman/listinfo/python-list

Re: trying to use sax for a very basic first xml parser

2008-07-15 Thread manu

>
> May I suggest you ask in the blender list?
>

Will do that and report back. Thank you!

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


Re: trying to use sax for a very basic first xml parser

2008-07-14 Thread manu
On Jul 14, 8:14 pm, Miki <[EMAIL PROTECTED]> wrote:


> Python is using an external library for SAX (expat IIRC).
> I *guess* the Python that comes with Blender don't have this library.
>
I don't know... I didnt install any external libraries for sax. I
think python comes with a standard sax library.
And before I had python installed Blender said at startup:
"Compiled with Python version 2.5.
Checking for installed Python... No installed Python found.
Some scripts will not run. Continuing happily"

After installing Python 2.5.2 it now says:
"Compiled with Python version 2.5.
Checking for installed Python... got it!"
So I think it is using the installed Python.

Could it be that I have to install the same python version Blender was
compiled with?
--
http://mail.python.org/mailman/listinfo/python-list


trying to use sax for a very basic first xml parser

2008-07-14 Thread manu
Hi,

I need to parse xml files for the Blender Game Engine. ATM I am trying
to get this script running in the BGE. This is my first script and I
dont have much experience programming...

import xml.sax

class PnmlHandler(xml.sax.ContentHandler):
def __init__(self):
self.inPlace=0

def startElement(self, name, attrs):
if name != "place": return
if attrs.getLength()==0: return

print 'Starting element:', name
print "attrs:", attrs.keys()
id = attrs.get("id", None)
print "id:", id

if name == "place":
self.inPlace=1

def endElement(self, name):
if name == "place":
self.inPlace=0



parser = xml.sax.make_parser()
parser.setContentHandler(PnmlHandler())
parser.parse(open("bpm.pnml","r"))

this works in the IDLE ide. Output:

Starting element: place
attrs: [u'id']
id: p9723441
Starting element: place
attrs: [u'id']
id: p26811937
Starting element: place
attrs: [u'id']
id: p24278422[/code]

but when I copy the script into blender and run it I get:

[code]Compiled with Python version 2.5.
Checking for installed Python... got it!
Traceback (most recent call last):
  File "Text", line 27, in 
  File "H:\Python25\lib\xml\sax\__init__.py", line 93, in make_parser
raise SAXReaderNotAvailable("No parsers found", None)
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found[/code]

Its probably a stupid question but thanks anyway!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Rpy Module

2008-05-16 Thread Manu Hack
On Fri, May 16, 2008 at 6:14 PM, Mike P <[EMAIL PROTECTED]>
wrote:

> Hi experts,
>
> I've just seen there is an R module, what i can't see easily is if you
> can / how to import other modules for R into the Rpy module
>
> Can anyone advise on this?


Say if you want to use Hmisc within rpy,

import rpy
rpy.r.library('Hmisc')

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

Re: mx Base module

2008-02-25 Thread Manu
Many thanx for your help
 python setup.py build --skip install command is working

Thanks Once again

   M


On Feb 25, 5:08 pm, "M.-A. Lemburg" <[EMAIL PROTECTED]> wrote:
> On 2008-02-25 17:27, Manu wrote:
>
> > Hi there,
>
> >   I am trying to install mx Base 
> > module(http://www.egenix.com/products/python/mxBase/
> > ) on my Redhat server. But om executing command "python setup.py
> > install"
>
> The file you downloaded is a prebuilt binary. For those, you
> have to use:
>
> python setup.py build --skip install
>
> Prebuilt binaries are similar to Python eggs in that they do
> not require a compiler. Unlike eggs, they give you full advantage
> of the distutils install command and all its options.
>
> http://www.egenix.com/products/python/mxBase/#Installation
>
>
>
> > I get following messages:
>
> > running install
> > running build
> > running mx_autoconf
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
> > prototypes -fPIC -D_GNU_SOURCE=1 -I/usr/local/include -c _configtest.c
> > -o _configtest.o
> > _configtest.c: In function 'main':
> > _configtest.c:4: warning: statement with no effect
> > gcc -pthread _configtest.o -L/usr/local/lib -L/usr/local/lib64 -o
> > _configtest
> > success!
> > removing: _configtest.c _configtest.o _configtest
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
> > prototypes -fPIC -D_GNU_SOURCE=1 -I/usr/local/include/python2.5 -I/usr/
> > local/include -c _configtest.c -o _configtest.o
> > success!
> > removing: _configtest.c _configtest.o
> > macros to define: [('HAVE_STRPTIME', '1')]
> > macros to undefine: []
> > running build_ext
>
> > building extension "mx.DateTime.mxDateTime.mxDateTime" (required)
> > building 'mx.DateTime.mxDateTime.mxDateTime' extension
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
> > prototypes -fPIC -DUSE_FAST_GETCURRENTTIME -DHAVE_STRPTIME=1 -Imx/
> > DateTime/mxDateTime -I/usr/local/include/python2.5 -I/usr/local/
> > include -c mx/DateTime/mxDateTime/mxDateTime.c -o build/temp.linux-
> > x86_64-2.5_ucs2/mx-DateTime-mxDateTime-mxDateTime/mx/DateTime/
> > mxDateTime/mxDateTime.o
> > gcc: mx/DateTime/mxDateTime/mxDateTime.c: No such file or directory
> > gcc: no input files
> > error: command 'gcc' failed with exit status 1
>
> > I am able to import mx but not mx.TextTools or mx.DateTime.
>
> > Please help to install this module.
>
> > Thanks in  advance
> >M
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Feb 25 2008)>>> 
> Python/Zope Consulting and Support ...http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ...http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/
>
> 
>
>  Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 
>
>eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>Registered at Amtsgericht Duesseldorf: HRB 46611

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


mx Base module

2008-02-25 Thread Manu
Hi there,

  I am trying to install mx Base module( 
http://www.egenix.com/products/python/mxBase/
) on my Redhat server. But om executing command "python setup.py
install" I get following messages:

running install
running build
running mx_autoconf
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
prototypes -fPIC -D_GNU_SOURCE=1 -I/usr/local/include -c _configtest.c
-o _configtest.o
_configtest.c: In function 'main':
_configtest.c:4: warning: statement with no effect
gcc -pthread _configtest.o -L/usr/local/lib -L/usr/local/lib64 -o
_configtest
success!
removing: _configtest.c _configtest.o _configtest
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
prototypes -fPIC -D_GNU_SOURCE=1 -I/usr/local/include/python2.5 -I/usr/
local/include -c _configtest.c -o _configtest.o
success!
removing: _configtest.c _configtest.o
macros to define: [('HAVE_STRPTIME', '1')]
macros to undefine: []
running build_ext

building extension "mx.DateTime.mxDateTime.mxDateTime" (required)
building 'mx.DateTime.mxDateTime.mxDateTime' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-
prototypes -fPIC -DUSE_FAST_GETCURRENTTIME -DHAVE_STRPTIME=1 -Imx/
DateTime/mxDateTime -I/usr/local/include/python2.5 -I/usr/local/
include -c mx/DateTime/mxDateTime/mxDateTime.c -o build/temp.linux-
x86_64-2.5_ucs2/mx-DateTime-mxDateTime-mxDateTime/mx/DateTime/
mxDateTime/mxDateTime.o
gcc: mx/DateTime/mxDateTime/mxDateTime.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1

I am able to import mx but not mx.TextTools or mx.DateTime.

Please help to install this module.

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


Re: Official IRC channel for Python?

2008-02-23 Thread Manu Hack
On 23 Feb 2008 22:21:59 -0800, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> "Manu Hack" <[EMAIL PROTECTED]> writes:
>  > > Really? maybe I'm been blocked from it...
>  > >  thanks.
>  >
>
> > Maybe you need your nick name to be recognized.  You need to register
>  > your nickname somewhere.
>
>  On freenode, you need to register your nick in order to send private
>  messages, but you can join a channel with an unregistered nick.  If
>  the nick is registered to someone else, you get a message saying to
>  identify (which in this situation actually means change nicks, since
>  you presumably don't have the password to identify as the other
>  person).
>
>  Manu, what happens when you try to join?  What happens if you change
>  nicks?  Can you connect to freenode at all?  Can you join other
>  channels?
>  --

For most of the channels there is not problem joining.  Only the
python channel I need to use message nickserv to identify in order to
join.  I'm not very into the irc thing so after the first time I
register the nickname and then I don't seem to remember  where I
registered.

LIke if I run /join python in irssi it gives  #python You need to be
identified to join that channel

so I need to run /msg nickserv identify my_password

and then I can join #python by running /join python.

Manu

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


Re: Official IRC channel for Python?

2008-02-23 Thread Manu Hack
On Sun, Feb 24, 2008 at 12:16 AM, js <[EMAIL PROTECTED]> wrote:
> Really? maybe I'm been blocked from it...
>  thanks.

Maybe you need your nick name to be recognized.  You need to register
your nickname somewhere.

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


Announcement: Python module for pacparser (parses proxy auto-config files)

2008-01-23 Thread Manu Garg
Fellas,

I am mighty pleased to announce the release of python module for
pacparser. pacparser is a library to parse proxy auto-config (PAC)
files. Proxy auto-config files are already a vastly used web proxy
configuration method these days (either directly or via web proxy
autodiscovery protocol) and almost all popular web browsers support
them. pacparser python module brings in PAC file parsing capability to
python programs. Using it, python web software can now work with proxy
auto-config files. I am hoping, web software programmers will
appreciate it. At least I've been looking for such a thing for a while
:).

For documentation and available packages, please visit project homepage at
http://code.google.com/p/pacparser

Direct download links:
Source archive:  http://pacparser.googlecode.com/files/pacparser-1.0.3.tar.gz
Compiled module for python 2.5 and win32:
http://pacparser.googlecode.com/files/pacparser-python25-1.0.3-win32.zip

I have tested the module to work on Python 2.2 - 2.5 on Linux and Win32.

Cheers :-),
Manu

-- 
Manu Garg
http://www.manugarg.com
"Journey is the destination of life."
-- 
http://mail.python.org/mailman/listinfo/python-list


Announcement: pacparser - a c library to parse proxy auto-config (pac) files

2007-12-17 Thread Manu Garg
Hi Folks,

I am very pleased to announce the release of "pacparser" - a C library
to parse proxy auto-config (PAC) scripts. Needless to say, PAC files
are now a widely accepted method for proxy configuration management
and almost all popular browsers support them. The idea behind
pacparser is to make it easy to add this PAC file parsing capability
to other programs. It comes as a shared C library with a clear API.
You can use it to make any C or python (using ctypes) program PAC
scripts intelligent.

For documentation and available packages, please visit project home page at:
http://code.google.com/p/pacparser

For the ones who like to start with source code, here is the link to
direct download for source code:
http://pacparser.googlecode.com/files/pacparser-1.0.0.tar.gz.

Cheers :-),
Manu
--
Manu Garg
http://www.manugarg.com
"Journey is the destination of the life."
-- 
http://mail.python.org/mailman/listinfo/python-list


property question

2007-10-08 Thread Manu Hack
hi all,

If I have a class A with A.x, A.y, A.z.  A.y and A.z are property and
in order to compute the value of them, A.y depends on A.x while A.z
depends on A.y and A.x.  If I call A.y, and A.z, the value A.y would
be computed twice.  Is there a smart way to avoid that as to A.y will
be recomputed only if A.x has been changed?  Now I can define more
variables to keep track of what is changed but when there are more
variables and the dependency becomes more involved it could be very
complicated.  Thanks a lot.

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


Re: RegEx question

2007-10-04 Thread Manu Hack
On 10/4/07, Robert Dailey <[EMAIL PROTECTED]> wrote:
> On 10/4/07, Adam Lanier <[EMAIL PROTECTED]> wrote:
> >
> > try @param\[(in|out)\] \w+
> >
>
> This didn't work either :(
>
> The tool using this regular expression (Comment Reflower for VS2005) May be
> broken...
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

How about @param\[[i|o][n|u]t*\]\w+ ?
-- 
http://mail.python.org/mailman/listinfo/python-list


IDisatch and pythoncom

2005-09-10 Thread Manu
Hi,
I have a COM component server that just exposes the IDispatch interface 
but when you use it in a VB app you can access other method. I think the 
way  to access the other methods( as does it VBA for ex)  is to use 
Invoke but don't know how to do it in python.
Say for ex i want to convert this very simple example with only 
IDispatch interface .

import win32com.client
o = win32com.client.Dispactch('Excel.Application')
o.WorkBooks.Add()

Thx for your help
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ftplib fails when directory name contains spaces

2005-05-27 Thread Manu
Oops..It was my mistake :(.
Directory name with spaces work by default.

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


ftplib fails when directory name contains spaces

2005-05-26 Thread Manu
Hi,
ftplib fails to cwd into a directory which contains spaces in it's
name.How do i correct this?

Regards
Manu

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