multilanguage site and user informations edition

2005-07-25 Thread Olivier
i need to create a multilinguage site and i need help :

first i want to know what is the best and simple solution for a
multilinguage site with plone 2?
i want some tutorial, how to and if possible exemple

next i need to modify the user standard information to put my personnal
information like address, phone numbre, city, ... and i want to modify the
search member form to find member by all information like city. if anyone
can help me please give me a link to a faq or how to .

thanks

PS: Sorry for the english.




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


Re: multilanguage site and user informations edition

2005-07-26 Thread Olivier
What do you mean about "a couple of day" ? because I need to do this for
next month (a beta version) and the final version for september. do you
think plone 2.1 will be release at this date ?

thanks.

Olivier.

- Original Message -
From: <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
Sent: Tuesday, July 26, 2005 9:30 PM
Subject: Re: multilanguage site and user informations edition


Olivier wrote:
> first i want to know what is the best and simple solution for a
> multilinguage site with plone 2?
> i want some tutorial, how to and if possible exemple

The best way to approach this is to wait a couple of days until Plone
2.1 is released, and use LinguaPlone + Plone 2.1, which should make
this very easy and transparent.

> next i need to modify the user standard information to put my personnal
> information like address, phone numbre, city, ... and i want to modify the
> search member form to find member by all information like city. if anyone
> can help me please give me a link to a faq or how to .

Most of this is detailed in the Plone Book, and it's really easy to add
in more attributes for your users if needed. The online version of the
book is here:
http://plone.org/documentation/manual/definitive-guide

I would assume the plone-users mailing list is a better place to post
this than the python language newsgroup. :)

Try http://plone.org/contact#users - you can also subscribe via NNTP if
you prefer the newsgroup format.

> PS: Sorry for the english.

Your English is more than good enough. Welcome to Plone. :)

--
_

 Alexander Limi · Chief Architect · Plone Solutions · Norway
 Consulting · Training · Development · http://www.plonesolutions.com
_
  Plone Co-Founder · http://plone.org · Connecting Content
  Plone Foundation · http://plone.org/foundation · Protecting Plone


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

Re: mod_python: what's going on here?

2005-09-05 Thread Olivier
Robert J. Hansen a écrit :

 > Does anyone have any experience with mod_python on OS X/Apache
 > environments?  Can anyone shed some light on 500s that don't leave
 > traces in the error logs, or what precise incantation I need to make
 > mod_python start serving up scripts?



Here is a setup that works for me on 10.3, with Apache2 2.54, python 
2.4.1 and mod_python 3.1.4, all installed from source. This should 
probably work also with your python from fink.

Apache2:
./configure --enable-mods-shared=all  --enable-so

Python:
./configure

mod_python:
./configure --enable-so


 > Also, if this is not appropriate for this group, does anyone know of a
 > Python group for which this is more appropriate?


The mod_python mailing list ? At http://www.modpython.org/ .

Regards,

 Olivier

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


Olivier Adret

2015-11-06 Thread olivier

 Je vais essayer de programmer en python. On verra bien !
--
https://mail.python.org/mailman/listinfo/python-list


Re: mod_python help!

2006-02-17 Thread Olivier
treelife a écrit :
> I'm getting and internal server error when | run the following
> mod_python script.  I am actually trying to run Django.
> 
> Script:
> 
> from mod_python import apache
> 
> def handler(req):
> req.content_type = 'text/plain'
> req.write("Under Construction")
> return apache.OK



You just cant't import mod_python.apache from the command line.
To run your scripts, you usually do things like (not tested):

try:
 from mod_python import apache
 APACHE = True
except ImportError:
 # for when I'm outside Apache
 APACHE = False


class DummyRequest:
 """Simulates a request object"""

 def write(self, mstr):
 print mstr

 # you may need some other things...


def handler(req):
 req.content_type = 'text/plain'
 req.write("Under Construction")
 if APACHE:
 return apache.OK


##
if __name__ == "__main__":
 req = DummyRequest()
 handler(req)


HTH,
Olivier
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best python module for Oracle, but portable to other RDBMSes

2006-02-24 Thread Olivier
[EMAIL PROTECTED] a écrit :
> I'm a little confused about what's out there for database modules at:
> 
>   http://python.org/topics/database/modules.html
> 
> What I'd like to do is use Python to access an Oracle 9.X database for
> exporting a series of tables into one aggregated table as a text file,
> for import into a mainframe database. The catch is that I'd like to
> write code that wouldn't need to be changed (much) if we switched from
> Oracle to some other RDBMS (still need to export out as a text file for
> import to the mainframe database.
> 
> Looks like I'd probably want to use something that conforms to the
> DB-API 2.0. 


You want to use cx_Oracle :

http://www.python.net/crew/atuining/cx_Oracle/index.html

which is nowadays the very best python Oracle driver.

Olivier



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


Re: Multiple versions of Python / PythonWin on the same machine?

2006-02-24 Thread Olivier
[EMAIL PROTECTED] a écrit :
> 
> Is it safe to install more than one version of Python / PythonWin on
> the same machine?

Sure, it is, just specify a different path for the installer. You'll 
probably want to create two scripts python21.bat and python24.bat and 
put them in your path to launch the relevant version at will.

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


Re: PYTHONPATH not working on Windows XP (?)

2007-09-03 Thread olivier
Hi,

> Any suggestions for adding my path to sys.path permanently?

You can write a file in Lib/site-packages with a 'pth' extension (the
name itself doesn't matter) containing the path you want to add.

Example:
MyCustomLib.pth:
C:/docs/utils

And be careful with path separator on win32. It should be "/" or "\\",
never "\".

Regards,

 Olivier


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


Re: Advice for creating a web app

2006-03-11 Thread Olivier
Hi there,


Jumping until blue a écrit :
> I have a number of files, mostly text files formatted using Markdown
> syntax but also pdfs and other types of files, that are stored in a
> folder hierarchy and I want to develop a web application where I can
> brows, view and search these files. The documents can be
> cross-linked.
> 
> Currently I use a basic CGI to view/format the markdown files but I
> don't know if I should continue to make my own system or if I should
> take advantage of some existing framework.
> 
> My requirements are:

...

You may be interested in pyblosxom (http://pyblosxom.sourceforge.net/).

It's filesystem based, allows different input formats (html, rest, plain 
text, I don't know about "Markdown syntax"), allows also to serve what 
they call static files (like your pdfs), and you can plug some search 
capacities (for instance, a wrap around grep).

I used to run it behind apache with cgi, but it should be possible to 
use it with a lightweight-no install web server.

HTH,

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


Secretly passing parameter to function

2012-12-05 Thread Olivier Scalbert

Hi all !

I have a problem that is not easy to explained, so I have tried to 
reduce it a lot.


We are using a framework, that we can not modify.

in framework.py:
def do(something):
   '''
   Here we are in a framework that can not be modified ...
   It does a lot of things

   and finally:
   '''
   something()

in test.py:
from framework import *

def step1():
   print "Do step1"

def step2():
   print "Do step2"


# We ask the framework to do some work.
do(step1)
do(step2)
do(step3)


We are writing step1, step2, ... and asking the framework to process them.
Everything is ok, until we want to add a parameter to some steps.
We want to be able to do that:

in test.py:
from framework import *

def step1(param):
   print "Do step1 with param"

def step2():
   print "Do step2"


# We ask the framework to do some work.

do(step1, param = None)
do(step1, param = [0, 1, 5]) # again
do(step2)

Of course it does not work ...
TypeError: do() takes exactly 1 argument (2 given)

And we can not modify the framework (in which "do" is defined.

One solution would be to use a global variable that can be set before 
each step. But it is not very elegant ...


One other approach would be to add dynamically an attribute the the 
step1 function, and retrieve it inside the function, but it is perhaps 
overkill.


Do you have some ideas ?

Thanks,


Olivier

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


integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
Hi there, 
I've been looking for 2 days for a way to convert integer to binary number 
0-padded, nothing... 
I need to get numbers converted with a defined number of bits. For example on 8 
bits 2 = 0010
I wrote the following:

#!/usr/bin/env python


def int2binPadded(number, size):
"""The purpose of this function is to convert integer number to binary 
number
0-padded."""
if type(number)!=int or number < 0:
raise ValueError, "should be a positive integer"
if type(size)!=int:
raise ValueError, "should be an integer"
if number > (2**size)-1:
raise ValueError, "number is too large"
# convert int to bin
b = str(bin(number))[2:]

if len(b) !=size:
b = (size-len(b))*"0"+b

return b


if __name__ == "__main__":
import sys
print int2binPadded(int(sys.argv[1]),int(sys.argv[2]))


This satisfies my needs !

Though, what do you think about it ?

Thank you for you remarks,

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


Re: integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
Thank you to all of you !! 

so finally, I can simply write :

#!/usr/bin/env python


def int2binPadded(number, size):
"""The purpose of this function is to convert integer number to binary 
number
0-padded."""
if type(number)!=int or number < 0:
raise ValueError, "should be a positive integer"
if type(size)!=int:
raise ValueError, "should be an integer"
if number > (2**size)-1:
raise ValueError, "number is too large"
# convert int to bin

return bin(number)[2:].zfill(size)


if __name__ == "__main__":
import sys
print int2binPadded(int(sys.argv[1]),int(sys.argv[2]))

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


Re: integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
You're right, I use Python 2.6.6 
-- 
http://mail.python.org/mailman/listinfo/python-list


Want to free hosting.

2011-03-04 Thread Rat Olivier

Hey

Want to free hosting... This is for very short time.

Visithttp://www.balticwebhost.com/aff.php?aff=001
-- 
http://mail.python.org/mailman/listinfo/python-list


Module use of python3_d.dll conflicts with this version of Python

2023-01-26 Thread Olivier B.
Hi,I am in the process of trying to make my code (an c++ executable
and swig modules using the Python C API) lose the dependency to python
3.7, to be compatible with all Python 3.2+

I tried linking to python.lib instead of python37.lib. As i am still
using a few things that are not in the limited API, my binaries now
have a dependency to python3.dll for the base stuff, and pyhton37.dll
for the few symbols that are not backwards compatible.

In release, that does not seem to bring issues. In debug (debug build
of my program that uses python debug build) however, when the process
is importing the swig python/c++ module, i get a
"Module use of python3_d.dll conflicts with this version of Python". I
checked that i am properly loading the python3_d.dll of my python37,
and python python37_d.dll too

Looking in dynload_win.c of python sources where the message is
triggered, indeed it is comparing in py case python37_d.dll to
python3_d.dll.
And i guess, in release, it works because in GetPythonModule(), there' is

#ifndef _DEBUG
/* In a release version, don't claim that python3.dll is
a Python DLL. */
if (strcmp(import_name, "python3.dll") == 0) {
import_data += 20;
continue;
}
#endif

Does someone know why it would have been chosen to be different for
debug builds?
-- 
https://mail.python.org/mailman/listinfo/python-list


téléchargement python

2021-09-23 Thread olivier Perchet





   Envoye `a partir de [1]Courrier pour Windows





   [2][IMG] Garanti sans virus. [3]www.avast.com

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
   2. 
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
   3. 
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
-- 
https://mail.python.org/mailman/listinfo/python-list


Cohabitation of debug and release python in the same folder

2016-11-25 Thread Olivier Barthelemy
If i try to build a normal python and a 'with-pydebug' python in the same 
folder, I can run both versions of python by running the real executable names 
instead of the generic name symlinks.

However, if i want to use sysconfig.get_config_var() to check "Py_DEBUG" (to 
then know from .py files whether i need to load debug or release versions of 
other python modules that need c++ compilation), the variables seem to have the 
value of the last version i installed.
In my case, i compiled and installed in debug, then in release, so the default 
names symlinks would still point to a release version. And get_config_vars() 
called from the debug python binary seem to have the values of the release one.

Is there any way to work around that conflict, should i file a bug  for it, or 
is it "expected" and i should just install my two pythons in different folders?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Alternatives to Stackless Python?

2005-09-23 Thread Olivier Dormond
Christophe wrote:
> [EMAIL PROTECTED] a écrit :
> 
>>> I found LGT http://lgt.berlios.de/ but it didn't seem as if the
>>> NanoThreads module had the same capabilites as stackless.
>>
>> What specific capabilities of Stackless are you looking for, that are
>> missing from NanoThreads?
> 
> Capabilities of the different "threadlike" systems are somewhat muddy. 
> What myself I like in stackless is :
> - you can put context switching instuctions anywhere in the callstack 
> without having to explicitely chain the operation
> - pickle support
> 
> Not sure if greenlets support pickling yet. There are no info on that 
> point and my tests weren't succesful.

The greenlets play with the underlying CPU stack directly so I don't
think they could ever be pickled.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickle to source code

2005-10-26 Thread Olivier Dormond
Gabriel Genellina wrote:
> Or perhaps:
> 
> xxx = new.instance(MyClass, {'a':1,'b':2,'done':1})
> 
> In other words, I need a *string* which, being sent to eval(), would
> return the original object state saved in the pickle.
> As has been pointed, repr() would do that for simple types. But I need
> a more general solution.

Doesn't pickle.loads just do what you need ? e.g.:

>>> pickled = file('test.dat', 'rb').read()
>>> obj = eval('pickle.loads(%r)'%pickled)
>>> obj
<__main__.MyClass instance at 0xb7bfb76c>
>>> obj.a, obj.b, obj.done
(1, 2, 1)
>>>

As I've never used the persistent_id mechanism of pickle I don't know
if that would do the trick.

Cheers,

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


python and visual C++

2005-02-02 Thread Olivier Ravard
Hi,

When I tryed to compile a python module using distutils under windows,
and there is an error message if we do not have Microsoft Visual C++ 6
installed.
This is because python have been compiled with MSVC6 and distutils wants it
in order to compile C++ python modules.

One of the reasons why I use python is because this is a free language. But
I need
a non free compilator to compile my C++ module !!! Choosing MSVC to compile
python is a strange choice since there are other free compilators like
MinGW.

I think that using another compilator should be possible in order to compile
python
modules since I use BOOST/MinGW to develop my own modules...

Diffrerent solutions appears :
- peoples who compile python for windows should use a free compilator
(MinGW or Microsoft Visual C++ Toolkit 2003 for example)
- modify distutils in order to use another compilator

Is there anyone that have experienced this "free" problem and is there a
solution
that I did not note. I don't want to buy MSVC...

Thanks

O.R.



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


Re: python and visual C++

2005-02-03 Thread Olivier Ravard

"Caleb Hattingh" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Olivier
>
> If you consider using the ctypes module, you can write a dll (windows) or
> a shared object (linux) using anything that can make one of those.
>
> For example, I have successfully used FreePascal to make a dynamic library
> on both windows and linux and use that library within python on both
> platforms.

Yes. I do this too. I make my own modules with C++/BOOST and compile them
with gcc under Linux and Windows.

But the problem is about modules thats are developped from others with
distutils...


>
> Heck, even the objectpascal code for the dll was unchanged on both
> platforms.  I simply needed to recompile the objectpascal file on each
> using FreePascal.  Also FreePascal is available on many more platforms
> (though not quite as many as python, I'll wager).

>
> This is the only way I ever intend making native binary additions to my
> own programs.
>
> Regards
> Caleb
>
>
> On Wed, 2 Feb 2005 12:35:08 +0100, Olivier Ravard
> <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > When I tryed to compile a python module using distutils under windows,
> > and there is an error message if we do not have Microsoft Visual C++ 6
> > installed.
> > This is because python have been compiled with MSVC6 and distutils wants
> > it
> > in order to compile C++ python modules.
> >
> > One of the reasons why I use python is because this is a free language.
> > But
> > I need
> > a non free compilator to compile my C++ module !!! Choosing MSVC to
> > compile
> > python is a strange choice since there are other free compilators like
> > MinGW.
> >
> > I think that using another compilator should be possible in order to
> > compile
> > python
> > modules since I use BOOST/MinGW to develop my own modules...
> >
> > Diffrerent solutions appears :
> > - peoples who compile python for windows should use a free
compilator
> > (MinGW or Microsoft Visual C++ Toolkit 2003 for example)
> > - modify distutils in order to use another compilator
> >
> > Is there anyone that have experienced this "free" problem and is there a
> > solution
> > that I did not note. I don't want to buy MSVC...
> >
> > Thanks
> >
> > O.R.
> >
> >
> >
>


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


what are PyObject *globals and PyObject *locals ?

2005-02-24 Thread Olivier Sessink
Hi all,

I want to make a value available to the global namespace of an embedded
python interpreter. Several functions of the Python/C API feature a
PyObject *globals and a PyObject *locals, so my guess is that these can be
used for this purpose. Unfortunately, the Python/C API does not describe
how this works.

If I want for example, to create a variable MyVar that can be read by the
python code in some filename, to be run with PyRun_AnyFile();, how can I
do this?

Or do I misunderstand the API, and can Py_InitModule() register both
functions *and* variables? (and how to register the variable then?)

regards,
Olivier

(I know extending is the preferred solution, unfortunately I was not aware
of this some years ago)

 And now a word from our sponsor --
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with millions of users it will allow you to grow!
  See http://netwinsite.com/sponsor/sponsor_dnews.htm  
-- 
http://mail.python.org/mailman/listinfo/python-list


How to delete a module file

2005-02-28 Thread Olivier Ravard
Hi everybody,

My application enables the developpment of new C++
modules that are dynamically loaded in this 
application.

My problem is that (under Windows) I can't delete a 
module that have been already imported. I must  
exiting the application (which is not a good idea for 
a developpment environnment).
i.e. I can't delete "module.pyd" if I made "import
module" in the python interpreter.

Is there some technics to "unload" modules under python ? or is there a
technic to force removing a file even it is used by another
application ?

Remark : This problem does not exist under Linux.

Thanks for your answers and ideas.

Olivier




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


Re: How to delete a module file

2005-03-03 Thread Olivier Ravard
Le lundi 28 fÃvrier 2005 Ã 17:08 +, Dennis Lee Bieber a Ãcrit :
> On Mon, 28 Feb 2005 16:43:45 +0100, Olivier Ravard
> <[EMAIL PROTECTED]> declaimed the following in
> comp.lang.python:
> 
> > 
> > Remark : This problem does not exist under Linux.
> >
>   I think Linux just masks the situation. Windows won't let you
> delete the file because the OS still has it open (linked) to the process
> that did the import.
> 
>   Linux deletes the directory entry, so other programs can't find
> the file -- but the OS still has an unseen link to the actual file; the
> actual file doesn't go away until the total link count falls to 0.
> 

So, what is the solution ?



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


Re: Vaults of Parnassus hasn't been updated for months

2005-12-23 Thread Olivier Grisel
Wolfgang Grafen a écrit :
> What happened to the Vaults of Parnassus? It was always my
> favourite resource for Python code since ever. The latest
> entry is now 8/23. It has been up to date for years but now...
> What a pity!

Everybody is using the cheeseshop now:

http://cheeseshop.python.org/pypi?%3Aaction=browse

-- 
Olivier

-- 
http://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 Olivier Grisel
gene tani a écrit :
> Shahriar Shamil Uulu wrote:
>> Thank you, for your directions and advices.
>> shahriar ...
> 
> also look:
> 
> http://spyced.blogspot.com/2005/09/how-well-do-you-know-python-part-9.html
> 
> whihc mentions twisted.python.reflect.findInstances(sys.modules, str)
> and objgrep, which i didn't know about
> 

This looks relevant too (not tested though):

http://pysizer.8325.org/

-- 
Olivier

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


Problem with using unittest module

2006-07-31 Thread Olivier Langlois
Hi,

I have the following statement in my test :

self.assertRaises(CDKeyException, ValidationObject.Validate,
1001,'NonExistantKey')

and the test fails as if assertRaises was not catching the thrown
exception:

==
ERROR: test (DBLookupValidationTests.DBLookupValidationTests)
--
Traceback (most recent call last):
  File
"C:\Dev\jade.r12sp\src\RVPackages\CDKey\Server\DBLookupValidationTests.py",
line 64, in test
self.assertRaises(CDKeyException, ValidationObject.Validate,
1001,'NonExistantKey')
  File "C:\tools\Python\lib\unittest.py", line 320, in failUnlessRaises
callableObj(*args, **kwargs)
  File
"C:\Dev\jade.r12sp\src/Services/local/Home\Scripts/system\CDKey\DBLookupValidation.py",
line 69, in Validate
raise CDKeyException, self.logger.error(e) CDKeyException

Any idea what is happening?

Thanks,
Olivier Langlois
http://www.olivierlanglois.net

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


RE: About the 79 character line recommendation

2006-12-05 Thread Olivier Langlois
Hi,

There was a coding standard where I worked and the intention behind this
requirement was to make the code printer friendly. Printing code source
with lines longer than 80 chars greatly hinder readability on paper.

Greetings,
Olivier Langlois
http://www.olivierlanglois.net
> 
> I also think that limiting code to 80 columns often hinders
> readability. I personally try to limit my code to 100 columns. The end
> result is pretty nice.
> 
> However, I'm all for the "flat is better than nested" philosophy, even
> when nested is under 100 columns.
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Optimize flag question

2006-02-24 Thread Olivier Langlois








Hi,

 

This is my first post on the list. I played with the –O
flag option and I found the hard way that it was breaking the scripts I am
using because they rely on the assert statement that the optimize flag remove. From
there, I tried to find more information on the effect that this flag has on
scripts but I have not found much…

 

So my question is: what are the ‘optimizations’
that the Python interpreter is doing when you specify the optimize flag and is
there anything I should be cautious about when using it?

 

Thank you,

Olivier Langlois

http://www.quazal.com

 






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

How to read an integer value from a binary file?

2005-05-03 Thread Olivier Elbaz
Hi,

I read a bmp file (binary file) and I want to extract an integer value
from it (size value).
The whole binary file is read inside a list "all_bmp_file".
I can read the "size" value with the following code:
for r in all_bmp_file[2:5]:
   n = struct.unpack('B',r)#B for unsigned char
   print n
Result:
(182,)
(47,)
(0,)
The problem is that I would like to read the 4 bytes (integer) as one
number like:
struct.unpack('i','\xb6/\x00\x00')
Result
(12214,)
Note that I can't use  struct.unpack('i',all_bmp_file[2:5]) inside my
program since I got a syntax error.

Could you help me to find a solution?
Thanks,
Olivier
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to read an integer value from a binary file?

2005-05-03 Thread Olivier Elbaz
Hi Jeff,

You was right, my problem was coming from the number of items that I
gave to the "unpack" method.
I was thinking,like an array in C, that slice [2:5] will give 4 items and not 3.

Thanks a lot for your help.
Olivier 

On 5/3/05, Jeff Epler <[EMAIL PROTECTED]> wrote:
> As your 'for' loop shows, the number of items in the slice [2:5] is only
> 3, not 4.
> 
> Maybe you want the slice [2:6] instead.
> 
> >>> x = "xx\xb6/\0\0"
> >>> struct.unpack('i', x[2:6])
> (12214,)
> 
> Jeff
> 
> 
>
-- 
http://mail.python.org/mailman/listinfo/python-list


_hashlib portability issue

2007-06-26 Thread Olivier Feys
Hi all,

I build python 2.5 on linux-x86-64 (centos).
Why is lib-dynload/_hashlib.so dynamically linked with libssl.so.0.9.7 
and not with libssl.so that points on it (same thing for libcrypto.so)?
This causes problems when copying all the python distribution and 
running it on a different os, where the theses lib versions are not 
allways the same.
Is it possible to configure that ?

thanks,

Olivier

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


Log-in to forums (using cookielib)?

2007-05-01 Thread Olivier Oost
Hi,

I need to login to a online forum, like a phpbb forum, and leave a 
message there. I figured I need to use cookielib, but the documentation 
of cookielib is not very clear to me.

I tried to just copy/paste all the cookies from FireFox into my 
Python-program, like this:
import cookielib, urllib2, urllib
cookiejar=cookielib.CookieJar()
urlOpener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))
values={'__utmb':'1234', 'mybbuser':'1234_1234', '__utmz':'1234', 
'sid':'1234', '__utma':'1234'}
data=urllib.urlencode(values)
request=urllib2.Request("http://ep2.nl",data)
url=urlOpener.open(request)
page=url.read(1024000)

Can someone please tell me how I should log-in and leave a message on 
the board?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Log-in to forums (using cookielib)?

2007-05-01 Thread Olivier Oost
Gabriel Genellina wrote:
> En Tue, 01 May 2007 04:44:57 -0300, Olivier Oost <[EMAIL PROTECTED]> 
> escribió:
> 
>> I need to login to a online forum, like a phpbb forum, and leave a 
>> message there. I figured I need to use cookielib, but the 
>> documentation of cookielib is not very clear to me.
>> Can someone please tell me how I should log-in and leave a message on 
>> the board?
> 
> Sure. But considering that this smells like an Automatic Spamming 
> Machine, I hope nobody will.
> 
> --Gabriel Genellina

No, it's not meant as a spamming machine. I only need to post a message 
and then (if that's possible) lock the topic (I'm admin on the forum 
where I need this). The program first needs to read the topic for 
certain words (that's already working), and then reply that those words 
aren't welcome.

I hope I made myself clear.
-- 
http://mail.python.org/mailman/listinfo/python-list


UTF-8

2007-03-10 Thread Olivier Verdier
First off: i thoroughly enjoy python. I use it for scientific  
computing with scipy, numpy and matplotlib and it's an amazingly  
efficient and elegant language.

About this mailing list: it is very hard to search. I can't find any  
search field on the page: http://mail.python.org/mailman/listinfo/ 
python-list. I would greatly appreciate if you moved that list over  
to google, for instance, so that it be both searchable and rss-feedable.

My question is the following: how to set a default encoding in  
python? I read an old thread about that and it didn't seem possible  
by then.

The default encoding i wish to set is UTF-8 since it encodes unicode  
and is nowadays the standard encoding. Having ascii as a default  
encoding is a pretty strange choice since ascii encodes only 127  
characters (suitable only for English, without fancy symbols like €)  
whereas utf-8 encodes virtually infinitely many characters (suitable  
for all languages). Besides, utf-8 is a superset of ascii so having  
it by default won't harm anything.

At the very least there should be a configuration file that allows to  
set a default encoding (although setting anything else than utf-8  
should be advised against). Such a feature would be greatly  
appreciated by all of us non native English speakers around the world.

Best regards,

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


get objects referencing another one

2007-02-05 Thread Olivier Feys
I'm working on a tree and I have refcounting problems.
Is it possible from an object, to get the list of objects referencing it ?

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


Re: Repr or Str ?

2007-02-06 Thread Olivier Feys

str is a text representation of the object, you can see it as a nice print
repr is the text representation of the object that you can evaluate to 
get the same object

Johny wrote:
> Where and when is good/nescessary to use `repr`  instead of `str` ?
> Can you please explain the differences
> Thanks
> LL
>
>   

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


Problem with installing MySQL-python-1.2.1_p2

2006-05-23 Thread Olivier Langlois
Hi,

I have tried to install MySQL-python-1.2.1_p2 under Windows XP with
Python 2.4.3 and I get some problems.

1- I get this warning when I run setup.py build:

C:\tools\Python\lib\distutils\extension.py:133: UserWarning: Unknown
Extension options: 'mysql_root'
  warnings.warn(msg)

2- When I compile _mysql.c, there are errors in the file:

DL_EXPORT(void)
init_mysql(void)
{
...
if (PyDict_SetItemString(dict, "version_info",
   PyRun_String(version_info, Py_eval_input,
   dict, dict)))
goto error;
if (PyDict_SetItemString(dict, "__version__",
   PyString_FromString(__version__)))

PyRun_String parameter version_info and PyString_FromString parameter
__version__ are not defined. I suspect that they should be surrounded by
double quotes but if I do that and compile _mysql.pyd. When that module
is initialized, python is crashing because PyRun_String returns a NULL
pointer instead of the expected valid PyObject pointer.

Is there anybody that can help me?

Thank you,
Olivier Langlois
http://www3.sympatico.ca/olanglois

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


read and readline hanging

2008-01-24 Thread Olivier Lefevre
I am calling subprocess.Popen with
p = Popen(args, bufsize=-1, stdin=PIPE, stdout=PIPE, stderr=PIPE)
and after sending come command to the process, I try to read
from p.stdout but after a few calls I hang. What is the correct
way to do this, i.e., to read everything w/o getting stuck? I am
not familiar with all these low-level functions and their annoying
blocking behaviour. Note that I don't want to close the process
because I want to send more commands to it after that, read the
results, and so on and on.

Thanks,

-- O.L.

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


Re: read and readline hanging

2008-01-25 Thread Olivier Lefevre
Hi Steve,

Thanks for the answer. Yes this is tricky. I have done it in Java
before, where you can, e.g., set up a thread to pump stuff out of
both stderr and stdout continuously but my python is too rudimentary
for that. There is a key difference anyway: in Java you can write

 while (br.readLine() != null) {  }

where br is the buffered reader in which you've wrapped the stdout
of the child process and it will not hang. But in python eventually
stdout.readline() hangs. This is a real nuisance: why can't it just
return None?

> 1. The subprocess has stopped producing output.

Indeed, if I do this interactively, I can tell after 3 lines that I've
gotten all there is to get right now and the fourth readline() call
hangs. But how can I find out *programmatically* that there is no more
input?

> If you are only reading its standard output, are you sure that the 
 > subprocess is flushing its buffers so you can recognize it's time to
 > provide more input?

The subprocess in a purely passive position: it is an interpreter: I
send it commands and I read the answers. The python side is in charge.

> 2. The subprocess has blocked because it has filled its stderr buffer 
> and is waiting for something (i.e. your program) to read it.

No, that's not it or it would hang immediately. I can get a few lines
out of stdout and then I hang because I can't tell when it's time to stop
pumping. But you are right that if there was something on stderr I would
be in trouble.

Regards,

-- O.L.

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


Re: read and readline hanging

2008-01-27 Thread Olivier Lefevre
> The `trheading` module is modeled after Java's threading API.

OK. Thanks for the hint. However BufferedReader.readline() does
not block in Java, so it is still difficult to transpose.

>> But how can I find out *programmatically* that there is no more
>> input?
> 
> You can't.

How do people handle this, then? Reading from a process that will
block if you ask too much yet won't let you know how much there is
to read right now has to be some kind of FAQ.

> This doesn't answer if the interpreter doesn't flush its output buffer
> after every line.

I think it must otherwise you might get incomplete answers or no
answers at the interactive prompt and that never happens. It may
not flush its buffer after every line but it must flush them at
the end of an answer.

-- O.L.

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


Re: read and readline hanging

2008-01-27 Thread Olivier Lefevre
>> Indeed, if I do this interactively, I can tell after 3 lines that I've
>> gotten all there is to get right now and the fourth readline() call
>> hangs.
> 
> Can you really? 

Yes interactively: at the command prompt, you can tell when it's over
because you know the command you just sent and whether it requires an
answer and of which kind. Also, even if there is no answer you get a
fresh prompt when the interpreter is done.

> Unless there is some way to differentiate between the last line
> and all the other lines of a response, you can't really be sure.

Yes, that has since occurred to me. I need to echo some magic string
after each command to know that I reached the end of the answer to
the previous command. In interactive mode the prompt fulfills that
role.

> To check if there is something to read at this very moment, you
> can use any of the following methods:

Thanks for all the suggestions! That is just what I needed.

>   - select.select()
>   - the FIONREAD ioctl (the ioctl() function lives in the fcntl
> module, and the FIONREAD constant is in the termios module)
>   - set the underlying file descriptor in non-blocking mode:
> flags = fcntl.fcntl(fd, fcntl.F_GETFL)
> fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NDELAY)
> After that, reads on the pipe will raise an IOError exception
> with the errorcode EWOULDBLOCK.

That sounds like the simplest approach.

>   - start a thread that does blocking reads from the pipe, and
> puts the chunks it reads on a queue for your main thread to
> grab.

Yes but my python threading is worse than rudimentary. I will look
into the `trheading` module suggested by the other poster.

> For the last approach, you might be interested in my asyncproc
> module, which does exactly that.  You can download it from
> .

OK, I'll look into that, too.

Thanks again,

-- O.L.

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


Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
>> Yes, that has since occurred to me. I need to echo some magic string
>> after each command to know that I reached the end of the answer to
>> the previous command. In interactive mode the prompt fulfills that
>> role.
> 
> And hope that that "magic string" does not occur somewhere within
> the response...

In a numerical setting there are strings you can be pretty sure will
not occur, esp. alone on their own line. It might be harder if you
were dealing with arbitrary text but I'm not.

> I think you would be better off looking into the correctly spelled
> 'threading' module rather than the misspelled 'trheading' module. :-)

That was a just a copy-and-paste from the original reply. It would
not have caused me to segfault not to find a module named 'trhreading':
I'm a human, not a 'puter ;-)

-- O.L.

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


Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
pexpect looks promising, thanks.

-- O.L.

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


Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
> The buffering behavior at the interactive prompt is very often different
> from connections via pipes.

I hadn't thought of that. I will ask on the Octave list.

Thanks,

-- O.L.

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


Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
>> But in python eventually stdout.readline() hangs. This is a real 
>> nuisance: why can't it just return None?
> 
> Because that would be quite annoying because most of the time people want
> blocking behavior.

Just an afterthought: do people prefer the blocking behaviour because
blocking until there's something to read is more economical of computer
resources than polling for a non-null read (what I was trying to do, in
effect)? The problem with polling is you need a minimum of 2 threads to
do anything useful: it is quite inconvenient to block in the main thread.

-- O.L.

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


segfault calling SSE enabled library from ctypes

2008-11-24 Thread Olivier Grisel
Hello,

It seems that I am able to reproduce the same problem as reported
earlier on this list by someone else:

  http://mail.python.org/pipermail/python-list/2008-October/511794.html

Similar setup: python 2.5.2 / gcc (Ubuntu 4.3.2-1ubuntu11) from
Intrepid on 32bit intel Core 2 Duo.  I can confirm this is not related
to any alignment problem from data passed from python, I took care of
that and I could even reproduce the problem with the following minimal
test case that does not use any external data (you can fetch the
following source here
http://www.bitbucket.org/ogrisel/ctypes_sse/get/tip.gz )



=== dummysse.c ===

#include 
#include 

void dummy_sse(void)
{
// allocate an alligned vector of 128 bits
__m128 myvector;

printf("[dummy_sse] before calling setzero\n");
fflush(stdout);

// initialize it to 4 32 bits float valued to zeros
myvector = _mm_setzero_ps();

printf("[dummysse] after calling setzero\n");
fflush(stdout);

// display the content of the vector
float* part = (float*) &myvector;
printf("[dummysse] myvector = {%f, %f, %f, %f}\n",
part[0], part[1], part[2], part[3]);
}

int main()
{
dummy_sse();
return 0;
}

=== dummysse.py ===

from ctypes import cdll

lib = cdll.LoadLibrary('./dummysse.so')
lib.dummy_sse()


=== Makefile ===
CC = gcc
CFLAGS = -Wall -g -O0 -msse2

all: dummysse dummysse.so

dummysse:
$(CC) $(CFLAGS) $(LIBS) -o dummysse dummysse.c
#   ./dummysse

dummysse.so:
$(CC) $(CFLAGS) $(LIBS) -shared -o dummysse.so dummysse.c
#   python dummysse.py

clean:
rm -f dummysse dummysse.so



By running the main of the C program I get the expected behavior:

  gcc -Wall -g -O0 -msse2  -o dummysse dummysse.c
  ./dummysse
  [dummy_sse] before calling setzero
  [dummysse] after calling setzero
  [dummysse] myvector = {0.00, 0.00, 0.00, 0.00}

Running from python, the call to the _mm_setzero_ps() segfaults:

  gcc -Wall -g -O0 -msse2  -shared -o dummysse.so dummysse.c
  python dummysse.py
  [dummy_sse] before calling setzero
  Segmentation fault

Is this to be expected? The result to a call to "valgrind python
dummysse.py" is available here :

  http://www.bitbucket.org/ogrisel/ctypes_sse/src/tip/valgrind.log

I am not familiar with python internal at all so I cannot understand
what's wrong. You can notice that valgrind make the program run till
the end and display the correct results (4 zeros) on stdout while
logging a bunch of errors (most of those are not related to our
problem since they appear when launching python on an empty script).

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


Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread Olivier Grisel
2008/11/25  <[EMAIL PROTECTED]>:
> On Nov 25, 4:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>>
>> You can't use ctypes for C++, only for C-style APIs.
>>
>> Diez
>
> With some work, you can convert your C++ objects to PyObject* and then
> return the latter in a function with C bindings.

http://cython.org also has some support for C++ bindings.

I also heard that Boost.Python is very well suited to make full
featured C++ / python bindings though I never tried myself.

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


Re: segfault calling SSE enabled library from ctypes

2008-11-25 Thread Olivier Grisel
Replying to myself:

haypo found the origin of the problem. Apparently this problem stems
from a GCC bug [1]  (that should be fixed on x86 as of version 4.4).
The bug is that GCC does not always ensure the stack to be 16 bytes
aligned hence the "__m128 myvector" local variable in the previous
code might not be aligned. A workaround would be to align the stack
before calling the inner function as done here:

http://www.bitbucket.org/ogrisel/ctypes_sse/changeset/dc27626824b8/

New version of the previous C code:



#include 
#include 


void wrapped_dummy_sse()
{
// allocate an alligned vector of 128 bits
__m128 myvector;

printf("[dummy_sse] before calling setzero\n");
fflush(stdout);

// initialize it to 4 32 bits float valued to zeros
myvector = _mm_setzero_ps();

printf("[dummysse] after calling setzero\n");
fflush(stdout);

// display the content of the vector
float* part = (float*) &myvector;
printf("[dummysse] myvector = {%f, %f, %f, %f}\n",
part[0], part[1], part[2], part[3]);
}

void dummy_sse(void)
{
(void)__builtin_return_address(1); // to force call frame
asm volatile ("andl $-16, %%esp" ::: "%esp");
wrapped_dummy_sse();
}

int main()
{
dummy_sse();
return 0;
}



[1] see e.g. for a nice summary of the issue
http://www.mail-archive.com/gcc%40gcc.gnu.org/msg33101.html

Another workaround would be to allocate myvector in the heap using
malloc / posix_memalign for instance.

Best,

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


Re: segfault calling SSE enabled library from ctypes

2008-11-30 Thread Olivier Grisel
I found an even simpler solution: use the -mstackrealign GCC option to
build the shared library.

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


Re: python and web programming, easy way...?

2008-04-27 Thread Olivier Parisy

David a écrit :


Also, I can't find any reference to cookies or sessions in the webpy
online docs. Maybe it's possible to bolt on support with Python's
Cookie module.


The web.py cookbook describes how to use sessions and cookies:
http://webpy.org/cookbook

Regards,
Olivier.
--
http://mail.python.org/mailman/listinfo/python-list


Re: str() should convert ANY object to a string without EXCEPTIONS !

2008-09-28 Thread Olivier Lauzanne
On Sep 28, 11:21 am, est <[EMAIL PROTECTED]> wrote:
> On Sep 28, 4:38 pm, Steven D'Aprano <[EMAIL PROTECTED]
> Can anyone tell me how to customize a default encoding, let's say
> 'ansi' which handles range(256) ?

I assume you are using python2.5
Edit the file /usr/lib/python2.5/site.py

There is a method called
def setencoding():
[...]
encoding = "ascii"
[...]

Change "encoding = "ascii" to encoding = "utf-8"

On windows you may have to use "mbsc" or something like that. I have
no idea what windows use at its encoding.

As long as all systems don't use the same encoding (let's say utf-8
since it is becoming the standard on unixes and on the web) using
ascii as a default encoding makes sense.

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


String comparison question

2006-03-19 Thread Olivier Langlois








Hi,

 

I would like to make a string comparison that would
return true without regards of the number of spaces and new lines chars between
the words

 

like ‘A   B\nC’ = ‘A\nB   
C’

 

What would be the easiest way to do it in Python?

 

Thanks,

Olivier Langlois

http://www.quazal.com

 

 






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

RE: String comparison question

2006-03-19 Thread Olivier Langlois
Hi Michael!

Your suggestion is fantastic and is doing exactly what I was looking
for! Thank you very much.
There is something that I'm wondering though. Why is the solution you
proposed wouldn't work with Unicode strings?

Olivier Langlois
http://www.quazal.com
> 
> import string
> NULL = string.maketrans("","")
> WHITE = string.whitespace
> 
> def compare(a,b):
>  """Compare two strings, disregarding whitespace -> bool"""
>  return a.translate(NULL, WHITE) == b.translate(NULL, WHITE)
> 
> Here, str.translate deletes the characters in its optional second
> argument.
> Note that this does not work with unicode strings.
> 
> Michael
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: String comparison question

2006-03-20 Thread Olivier Langlois
Hi Michael,

Normalizing the whitespace is what I was looking to do. I guess that
that aspect of my original query was not enough clear. But with either
solutions, I get the result I wanted.

Greetings,
Olivier Langlois
http://www.quazal.com
 
> -Original Message-
> Fredrik Lundh wrote:
> 
> >
> >>>> " hello world ".split()
> > ['hello', 'world']
> 
> a.split() == b.split() is a convenient test, provided you want to
> normalize
> whitespace rather than ignore it.  I took the OP's requirements to
mean
> that
> 'A   B' == 'AB', but this is just a guess.
> 
> 
> Michael
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 32-bit python on Opteron, Solaris 10?

2006-04-09 Thread Olivier P
Gary Robinson wrote:

> I'm in the market for a server to run some python code which is
> optimized via psyco.
> 
> Sun T2100 servers come with Solaris 10, which comes with python
> pre-installed.

You can always install a 32bits version of Linux or Solaris on the X2100
yourself. The X2100 is even certified to run on it .
cf http://www.sun.com/servers/entry/x2100/os.jsp
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Memory limit to dict?

2006-04-11 Thread Olivier Langlois
Just out of curiosity. What is the OS that you are using? I am asking
because I do not know about XP 64bits edition but if you are using
Windows XP 32 bits version, no matter how much RAM you have on your
machine, the OS has an inherent 4GB address space limit per process.

Olivier Langlois
http://www.quazal.com

> -Original Message->
> I was wondering whether certain data structures in Python, e.g. dict,
> might have limits as to the amount of memory they're allowed to take
up.
> Is there any documentation on that?
> 
> Why am I asking? I'm reading 3.6 GB worth of BLAST output files into a
> nested dictionary structure (dict within dict ...). Looks something
like
> this:
> 
> { GenomeID:
>   { ProteinID:
> { GenomeID:
>   { ProteinID, Score, PercentValue, EValue } } } }
> 
> Now, the thing is: Even on a machine with 16 GB RAM, the program
> terminates with a MemoryError, obviously long before the machine's RAM
> is used up.
> 
> I've no idea how far the Windows task manager's resource monitor can
be
> trusted -- probably not as far as I could throw a heavy-set St Bernard
> --, but it seems to stop roughly when that monitor records a swap file
> size of 2.2 GB.
> 
> Barring any revamping of the code itself, which I will have to do
> anyway, is there anything so far that would indicate a problem
inherent
> to Python?
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Memory limit to dict?

2006-04-11 Thread Olivier Langlois
That is a good observation!

Considering that hash tables to have good performance need to have a
fill rate of 70% or lower means that if you try to fit 3.6 GB of data
into a dict, your memory requirement will be much higher than 3.6GB.

BTW, this brings a new question. How does Python controls dictionnaries
fill rate, hash collisions and tables rehashes?
> 
> I don't have the answer to your question and I'll make a new one:
isn't
> the overhead (performance and memory) of creating dicts too large to
be
> used in this scale?
> 
> I'm just speculating, but I *think* that using lists and objects may
be
> better.
> 
> My 2 cents,
> 
> --
> Felipe.
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Memory limit to dict?

2006-04-11 Thread Olivier Langlois
With 32 bits address space, you have exactly 4GB. Of course out of that
4GB, the OS reserves some of that space for itself. So I think that 2GB
of available memory for a user process is good approximation. However,
on top of that, you need to account for space overhead that Python and
the OS heap management will generate. I have written an article
discussing memory allocation overhead:

http://www3.sympatico.ca/olanglois/CFixAlloc.html

It is for C++ but I believe that concepts still apply for Python users
and could give the original poster a better understanding about the
problem he is facing.

I have kept thinking about the original problem and I now believe that
the only solution if he wants to store 3.6GB of data in a Python script
is to recompile Python in 64 bits. I do not know if this is something
that someone has already done successfully...

Olivier Langlois
http://www.quazal.com
 

> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:python-
> [EMAIL PROTECTED] On Behalf Of Burton
Samograd
> Sent: April 11, 2006 2:10 PM
> To: [email protected]
> Subject: Re: Memory limit to dict?
> 
> Peter Beattie <[EMAIL PROTECTED]> writes:
> 
> 
> > I've no idea how far the Windows task manager's resource monitor can
be
> > trusted -- probably not as far as I could throw a heavy-set St
Bernard
> > --, but it seems to stop roughly when that monitor records a swap
file
> > size of 2.2 GB.
> 
> Not being a windows expert at all, but I would assume with 32 bit
> windows each process in the system can have an address space of ~2
> gigs.  In linux the process address space is split in half, bottom 2
> gigs for OS mappings, top for the process, so it looks like you might
> just be hitting the maximum allowed address space mapping.
> 
> You should partition your data into hierarchial modules and let python
> do the swapping for you...although you have 16 gigs (I have to put a
> holy crap after that!) you will always run into process limits, at
> least until true 64 bit os's are in vouge.
> 
> --
> burton samograd   kruhft .at.
gmail
> kruhft.blogspot.com   www.myspace.com/kruhft  metashell.blogspot.com
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and 3d

2009-09-14 Thread Olivier Renouard
Kevin MacPhail wrote:
>
>
> On Sun, Sep 13, 2009 at 2:29 PM, Ryniek90  <mailto:[email protected]>> wrote:
>
>
> >
> > azrael wrote:
> >
> >> Has anyone any exipience with python and 3d.
> >>
> >> I mean, is there a module to deal with popular 3d formats like
> 3ds, or
> >> vrml. is it possible to import into python opengl models and
> then use
> >> it in application for GUI purposes like through WX. I know that WX
> >> supports OpenGL but how to import models from file.
> >>
> >>
> > http://www.vrplumber.com/py3d.py
> >
> > There's a few older projects to load 3DS files, but I don't
> think any of
> > them is currently PyOpenGL 3.x compatible.  OpenGLContext loads
> VRML97
> > files (with SimpleParse installed).  Pyglet, OpenGLContext and Ian
> > Mallet's game engine all load .obj models (I believe Ian's
> engine is the
> > most advanced there).  Pivy should load VRML files as well, and
> has a
> > very powerful engine (COIN) under the covers (OpenGLContext is
> more of a
> > demo/testing system).  The big engines (Ogre, Soya, OpenSceneGraph,
> > Crystal Space, etc) should all have content loaders, though I
> haven't
> > played with them enough to be able to say what formats they support.
> >
> > HTH,
> > Mike
> >
> >
>
> Maybe check out:
>
> - Panda3D ( http://www.panda3d.org/ ),
> - PyGame ( http://www.pygame.org/news.html ),
> - PyKyra ( http://www.alobbs.com/pykyra ),
> - PyOpenGL ( http://pyopengl.sourceforge.net/ ),
>
> or
>
> Blender ( http://www.blender.org/ ).
>
> All above deserve attention.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
>
> Also worth mentioning:
>
> - The Python Computer Graphics Kit ( http://cgkit.sourceforge.net )
>
> Cheers
>
And you could add Cortex, http://cortex.devjavu.com, various C++
libraries with Python binding to manipulate 3d content creation format
and either display them in OpenGL format or export them to RIB format
for rendering.




-- 
Olivier Renouard

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


Question on using urllib

2010-11-11 Thread Olivier Scalbert
Hello all,

Sorry if this question is not 100% python related, it is also related to
http or html ...

Everything takes place in this page:
http://www.infometeo.be/klanten/KYC/campage2mega.php

With the following program, I can download the 2 small meteo images,
without any problem:

import urllib

urllib.urlretrieve("http://www.infometeo.be/wwweather/currentimage.php?icao=EBFN";,
"meteo1.jpg")
urllib.urlretrieve("http://www.meteokust.be/metstatgr.php?s=zb";,
"meteo2.jpg")

But I would like to download the main background picture.

By looking inside the html page, it seems it's url is:
http://www.infometeo.be/img.php?iid=1057

...



http://www.infometeo.be/img.php?iid=1057";>


...

Warning, the iid may vary depending time ...

I try to download it with python:
urllib.urlretrieve("http://www.infometeo.be/img.php?iid=1057";,
"picture.jpg")
But then I receive only 2 bytes: CR LF I think.

If I use this url with my browser (firefox), I also get nothing (a blank
page).
If I go back to the main page with the firebug plugin activated, I can
change the iid directly inside the html code with firebug, and then,
even previous pictures can be displayed ...

So I am a bit lost ... Any help would be very appreciate !!

Thanks,

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


Re: Question on using urllib

2010-11-11 Thread Olivier Scalbert
On 11/11/2010 06:37 PM, Peter Otten wrote:

> The problem is indeed not Python-related. The provider of the images doesn't 
> like what you're trying to do and verifies the referer, i. e. that the page 
> you claim to be coming from is acceptable. Here's one way to satisfy that 
> check:
> 
>>>> from urllib2 import Request, urlopen
>>>> r = Request("http://www.infometeo.be/img.php?iid=1057";, 
> headers=dict(Referer="http://www.infometeo.be/img.php?iid=1057";))
>>>> img = urlopen(r).read()
>>>> with open("tmp.jpg", "w") as f: f.write(img)
> ...
>>>>
> 
> Now if you are using that workaround a lot he may come up with more 
> sophisticated techniques. So dont ;)
> 
> Peter

Thanks Peter, it works perfectly !
At 60 fps I can even make a video ...
;-)

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


import directory error

2005-01-31 Thread Olivier Noblanc ATOUSOFT
Hello,


When i want to import a .py fire from another subdirectory i make

import inc/setupxml


but that make me an error message.

A man tell me to put a dot but that doesn't work.

Can you help me ?

Thanks.



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


Re: import directory error

2005-01-31 Thread Olivier Noblanc ATOUSOFT
Problem solved thanks a lot


"Steve Holden" <[EMAIL PROTECTED]> a écrit dans le message de news: 
[EMAIL PROTECTED]
> Olivier Noblanc ATOUSOFT wrote:
>
>> Hello,
>>
>>
>> When i want to import a .py fire from another subdirectory i make
>>
>> import inc/setupxml
>>
>>
>> but that make me an error message.
>>
>> A man tell me to put a dot but that doesn't work.
>>
>> Can you help me ?
>>
>> Thanks.
>>
>>
>>
> If you want to import a single .py (a Python module) then the ONLY way to 
> achieve that is to make sure it appears in a directory that is a member of 
> the sys.path list. (This is a slight simplification, but it will do as 
> long as you are only importing from the file store).
>
> There are various ways to affect the contents of sys.path, the best known 
> of which include
>
>1. Setting the PYTHONPATH environment variable
>2. Creating *.pth files
>3. Altering sys.path inside site-customize.py in
>   your standard library
>
> Python does allow you to implement PACKAGES, which are directories 
> containing
>
>a) a file called __init__.py and (optionally)
>b) other modules (.py files) and packages (directories
>   containing __init__.py files).
>
> The Python interpreter looks for packages in all the same places it looks 
> for modules, but it imports packages by running the __init__.py file (as 
> usual, this happens on the *first* time the package is imported).
>
> So, for example, under Cygwin or Linux/Unix, I can define a package (with 
> no Python in it, but still obeying the rules) as follows:
>
> [EMAIL PROTECTED] ~
> $ mkdir mp1
>
> [EMAIL PROTECTED] ~
> $ touch mp1/__init__.py
>
> [EMAIL PROTECTED] ~
> $ touch mp1/rhubarb.py
>
> [EMAIL PROTECTED] ~
> $ mkdir mp1/p2
>
> [EMAIL PROTECTED] ~
> $ touch mp1/p2/__init__.py
>
> [EMAIL PROTECTED] ~
> $ python
> Python 2.4 (#1, Dec  4 2004, 20:10:33)
> [GCC 3.3.3 (cygwin special)] on cygwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import sys
>  >>> "" in sys.path
> True
>  >>> import mp1
>  >>> import mp1.rhubarb
>  >>> import mp1.p2
>  >>>
>
> [EMAIL PROTECTED] ~
> $ find mp1
> mp1
> mp1/p2
> mp1/p2/__init__.py
> mp1/p2/__init__.pyc
> mp1/rhubarb.py
> mp1/rhubarb.pyc
> mp1/__init__.py
> mp1/__init__.pyc
>
> In this case mp1.rhubarb is a module from the mp1 package, mp1.p2 is a 
> sub-package of mp1. You can see what's been compiled by the interpreter on 
> import and when by looking at the .pyc files.
>
> Does this help any?
>
> regards
>  Steve
> -- 
> Steve Holden   http://www.holdenweb.com/
> Python Web Programming  http://pydish.holdenweb.com/
> Holden Web LLC  +1 703 861 4237  +1 800 494 3119 


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


import doesn't work as i want

2005-01-31 Thread Olivier Noblanc ATOUSOFT
Hello,

In the botom of this post you will see my source code.

The problem is when i launch main.py that doesn't make anything why ?

Thanks
olivier noblanc
Atousoft
http://www.logiciel-erp.fr



I have main.py :

-
import wx
import inc.importlist
--

inc/importlist.py

import wx.grid
import getdata
import time
import sys
---

inc/wxgrid.py
-
# -*- coding: cp1252 -*-


#starta = time.time()
import wx
import getdata

class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.grid_1 = wx.grid.Grid(self, -1, size=(1, 1))

self.__set_properties()
self.__do_layout()
# end wxGlade

def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("frame_1")
self.SetSize((400, 400))
# end wxGlade

self.grid_1.CreateGrid(len(db.data), len(db.fields))

# met les labels des colonnes
index = 0
for item in db.fields:
self.grid_1.SetColLabelValue(index, item[0])
index += 1

# remplissage des données.
for row in range(len(db.data)):
for col in range(len(db.data[row])):
values = db.data[row][col]
self.grid_1.SetCellValue(row,col,str(values))

# mise en forme et affichage
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(self.grid_1, 1, wx.EXPAND, 0)
self.SetAutoLayout(True)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade

# end of class MyFrame


if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
#startb = time.time() - starta
#print startb
app.MainLoop()


---

inc/getdata.py
--
import MySQLdb


class Eb_db:
def __init__(self):
try:
connection = MySQLdb.connect(host="dellced", user="ats", 
passwd="",db="atsmedicdatabase" )
cursor = connection.cursor()
cursor.execute( "SELECT * FROM PATIENT " )
except MySQLdb.OperationalError, message:
errorMessage = "Error %d:\n%s" % ( message[ 0 ], message[ 1 ] )
return
else:
 self.data = cursor.fetchall()
 self.fields = cursor.description
 cursor.close()
 connection.close()


-




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


Re: import doesn't work as i want

2005-01-31 Thread Olivier Noblanc ATOUSOFT
how to move in function ?

"Fredrik Lundh" <[EMAIL PROTECTED]> a écrit dans le message de news: 
[EMAIL PROTECTED]
> Olivier Noblanc wrote:
>
>> In the botom of this post you will see my source code.
>>
>> The problem is when i launch main.py that doesn't make anything why ?
>
> the "if __name__" statement checks the name of the module.  if you run
> Python file as a script, by passing a filename to the python interpreter, 
> the
> __name__ variable is set to  "__main__".  if you import a file as a 
> module,
> the __name__ is the name of the module, not "__main__".
>
> if you want main.py to do something, move that code to main.py (or move
> it into a function, and call it from main.py)
>
> 
>
> 


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


find isset() php function equivalent in python

2005-02-01 Thread Olivier Noblanc ATOUSOFT
Hello


What is the equivalent function of php isset() in python

Thank you very much.

olivier noblanc
http://www.logiciel-erp.fr 


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


Re: scripting browsers from Python

2005-05-31 Thread Olivier Favre-Simon
On Tue, 31 May 2005 00:52:33 -0700, Michele Simionato wrote:

> I would like to know what is available for scripting browsers from
> Python.
> For instance, webbrowser.open let me to perform GET requests, but I
> would like
> to do POST requests too. I don't want to use urllib to emulate a
> browser, I am
> interested in checking that browser X really works as intended with my
> application. Any suggestion?
> 
>Michele Simionato


ClientForm  http://wwwsearch.sourceforge.net/ClientForm/

I use it for automation of POSTs of entire image directories to
imagevenue.com/imagehigh.com/etc hosts.

Works above urllib2.

You access forms by name or indice, then you access HTML elements as a
dict attribute of the form.

Support file upload within POST.

The only drawback I've found are:
- does not support nested forms (since forms are returned in a list)
- does not like ill-formed HTML (Uses HTMLParser as the underlying parser.
you may pass a parser class as parameter (say SGMLParser for greater
acceptance of stupid HTML code) but it's tricky because there is no well
defined parser interface)

Hope this helps.

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


Re: scripting browsers from Python

2005-06-01 Thread Olivier Favre-Simon
On Wed, 01 Jun 2005 22:27:44 +, John J. Lee wrote:

> Olivier Favre-Simon <[EMAIL PROTECTED]> writes:
> 
>> On Tue, 31 May 2005 00:52:33 -0700, Michele Simionato wrote:
>> 
>> > I would like to know what is available for scripting browsers from
>> > Python.
> [...]
>> ClientForm   http://wwwsearch.sourceforge.net/ClientForm/
>> 
>> I use it for automation of POSTs of entire image directories to
>> imagevenue.com/imagehigh.com/etc hosts.
> 
> This doesn't actually address what the OP wanted: it's not a browser.

Yep. Didn't read with sufficient care. He really wants scripting not
webscraping.

> 
> 
>> The only drawback I've found are:
>> - does not support nested forms (since forms are returned in a list)
> 
> Nested forms??  Good grief.  Can you point me at a real life example of
> such HTML?  Can probably fix the parser to work around this.

What I mean is: The parser does not detect a missing , so
thinks that there are nested forms, and raises a ParseError.

Browsers have an easier task at spotting non-matching form tags, because
they can use matching table or div tags around to imply that the form is
closed (DOM approach).

Not easy with a SAXish approach like HTMLParser.

I don't mean nested forms should be supported, they are crap (is this even
legal code ?)

> 
> 
>> - does not like ill-formed HTML (Uses HTMLParser as the underlying
>> parser. you may pass a parser class as parameter (say SGMLParser for
>> greater acceptance of stupid HTML code) but it's tricky because there
>> is no well defined parser interface)
> 
> Titus Brown says he's trying to fix sgmllib (to some extent, at least).
> 
> Also, you can always feed stuff through mxTidy.
> 
> I'd like to have a reimplementation of ClientForm on top of something
> like BeautifulSoup...
> 
> 
> John

When taken separately, either ClientForm, HTMLParser or SGMLParser work
well.

But it would be cool that competent people in the HTML parsing domain join
up, and define a base parser interface, the same way smart guys did with
WSGI for webservers.

So libs like ClientForm would not raise say an AttributeError if some
custom parser class does not implement a given attribute.

Adding an otherwise unused attribute to a parser just in case one day it
will interop with ClientForm sounds silly. And what if ClientForm changes
its attributes, etc.

No really, whatever the chosen codebase, a common parser interface would
be great.


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


Memory allocation problem with python 2.4.3

2007-04-09 Thread Brice-Olivier Demory
Hi,

I'm encountering an odd problem while running a python script which
calls a C program
called 'st_time' :

Traceback (most recent call last):
  File "ccdd.py", line 177, in ?
answer=proc_request(conn,addr,request)  # proc
the
request
  File "ccdd.py", line 69, in proc_request
answer = '1&%s'%(ccd.exec_function(fct,arg))
  File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 204, in
exec_function
return apply(self.funcs[name],args)
  File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 731, in
mpose
answer = self.download()
  File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 1152,
in download
   st = libastro.st_time(ut,LON)
  File "/opt/OFXB/lib/python2.4/site-packages/libastro.py", line 169,
in st_time
   raise e
OSError: [Errno 12] Cannot allocate memory

This error is far from appearing each time I invoke st_time. To debug
this problem,
a friend of mine tried to get memory information as soon as this error
is raised. Here, it
returns :

MemTotal:   774856 kB
 MemFree: 22952 kB
 Buffers:  3656 kB
 Cached: 127600 kB
 SwapCached:   6308 kB
 Active: 626132 kB
 Inactive:75452 kB
 HighTotal:   0 kB
 HighFree:0 kB
 LowTotal:   774856 kB
 LowFree: 22952 kB
 SwapTotal: 1116476 kB
 SwapFree:   647064 kB
 Dirty:  12 kB
 Writeback:   0 kB
 Mapped: 621524 kB
 Slab:28268 kB
 CommitLimit:   1503904 kB
 Committed_AS:  1146312 kB
 PageTables:   2472 kB
 VmallocTotal:   245752 kB
 VmallocUsed:  8992 kB
 VmallocChunk:   236384 kB


Nothing indicates a lack of memory.
I'm running the following version of python :

Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]

Does somebody has an idea about what's happening ?

Many thanks for your time,
Brice

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


Encounter issues to install Python

2018-10-08 Thread Olivier Oussou via Python-list
Hi!I downloaded and installed python 3.6.4 (32-bit) on my computer but I have 
problems and can not access the python interface.
I need your technical assistance to solve this matter. 

Best regard!

Olivier OUSSOUMedical entomologist, Benin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Encounter issues to install Python

2019-01-06 Thread Olivier Oussou via Python-list
 Hi dear Anthony,I am using Windows systeme. I have download the set up uf 
python 3.6.4 (32-bit) and I can not install the software on my computer. I need 
your technical assistance to solve this matter and I will be glad if you do so.
Best regard!
OlivierMedical entomologist, Benin


Le samedi 13 octobre 2018 à 19:24:28 UTC+2, Anthony Flury 
 a écrit :  
 
  
Olivier, 
 
 
Welcome to the list - before we can help you, we need some more information : 
 

   - What Operating system are you using - Windows/Mac/Linux/Raspberry 
Pi/Android for something else ?
   -  What command or installer did you use to try to install Python.   
 
   - What issues did you have during installation - if any ?   
 
   - What interface are you trying to access, and how are you doing that ?
   - Do you get error messages?   
 
 Unless you tell us what the problem is we can't possibly help.
 
 On 08/10/18 20:21, Olivier Oussou via Python-list wrote:
  
 Hi!I downloaded and installed python 3.6.4 (32-bit) on my computer but I have 
problems and can not access the python interface.
I need your technical assistance to solve this matter. 

Best regard!

Olivier OUSSOUMedical entomologist, Benin
 
 
 -- 
 Anthony Flury
 Email : [email protected]
 Twitter : @TonyFlury
-- 
https://mail.python.org/mailman/listinfo/python-list


Making 'compiled' modules work with multiple python versions on Linux

2024-03-28 Thread Olivier B. via Python-list
I have a python module that includes some C++ code that links with the
Python C API

I have now modified the c++ code so that it only uses the Limited API,
and linked with python3.lib instead of python311.lib.

I can now use that python module with different python versions on Windows

But on Linux, it seems that linking to libpython3.so instead of
libpython3.11.so.1.0 does not have the same effect, and results in
many unresolved python symbols at link time

Is this functionality only available on Windows?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Making 'compiled' modules work with multiple python versions on Linux

2024-03-29 Thread Olivier B. via Python-list
It is not a symlink on my system, where i built python myself, but a
15KB so file. But it seems to lack lots of python symbols.

Maybe what i should do is actually make libpython.so a physical copy
of libpyton311.so before linking to it, so now on any system the
module would look to load libpython.so, which could be pointing to any
version. I'll try that next

Le ven. 29 mars 2024 à 10:10, Barry  a écrit :
>
>
>
> > On 28 Mar 2024, at 16:13, Olivier B. via Python-list 
> >  wrote:
> >
> > But on Linux, it seems that linking to libpython3.so instead of
> > libpython3.11.so.1.0 does not have the same effect, and results in
> > many unresolved python symbols at link time
> >
> > Is this functionality only available on Windows?
>
> Python limited API works on linux, but you do not link against the .so on 
> linux I recall.
>
> You will have missed that libpython3.so is a symlink to libpython3.11.so.10.
>
> Windows build practices do not translate one-to-one to linux, or macOS.
>
> Barry
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


First two bytes of 'stdout' are lost

2024-04-11 Thread Olivier B. via Python-list
I am trying to use StringIO to capture stdout, in code that looks like this:

import sys
from io import StringIO
old_stdout = sys.stdout
sys.stdout = mystdout = StringIO()
print( "patate")
mystdout.seek(0)
sys.stdout = old_stdout
print(mystdout.read())

Well, it is not exactly like this, since this works properly

This code is actually run from C++ using the C Python API.
This worked quite well, so the code was right at some point. But now,
two things changed:
 - Now using python 3.11.7 instead of 3.7.12
 - Now using only the python limited C API

And it seems that now, mystdout.read() always misses the first two
characters that have been written to stdout.

My first ideas was something related to the BOM improperly truncated
at some point, but i am manipulating UTF-8, so the bom would be 3
bytes, not 2.

I ruled out wrong C++ code to extract the string from the python
variable, since running a python print of the content of mystdout in
the real stdout also misses the two first characters.

Hopefully someone has a clue on what would have changed in Python for
this to stop working compared to python 3.7?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First two bytes of 'stdout' are lost

2024-04-11 Thread Olivier B. via Python-list
Partly answering myself:

For some reason, right after mystdout has been created, i now have to
do mystdout.seek(0) and this solves the issue.

No idea why though..

Le jeu. 11 avr. 2024 à 14:42, Olivier B.
 a écrit :
>
> I am trying to use StringIO to capture stdout, in code that looks like this:
>
> import sys
> from io import StringIO
> old_stdout = sys.stdout
> sys.stdout = mystdout = StringIO()
> print( "patate")
> mystdout.seek(0)
> sys.stdout = old_stdout
> print(mystdout.read())
>
> Well, it is not exactly like this, since this works properly
>
> This code is actually run from C++ using the C Python API.
> This worked quite well, so the code was right at some point. But now,
> two things changed:
>  - Now using python 3.11.7 instead of 3.7.12
>  - Now using only the python limited C API
>
> And it seems that now, mystdout.read() always misses the first two
> characters that have been written to stdout.
>
> My first ideas was something related to the BOM improperly truncated
> at some point, but i am manipulating UTF-8, so the bom would be 3
> bytes, not 2.
>
> I ruled out wrong C++ code to extract the string from the python
> variable, since running a python print of the content of mystdout in
> the real stdout also misses the two first characters.
>
> Hopefully someone has a clue on what would have changed in Python for
> this to stop working compared to python 3.7?
-- 
https://mail.python.org/mailman/listinfo/python-list


Changing path to python in pip.exe, ipython.exe, etc

2024-04-25 Thread Olivier B. via Python-list
I am building a python work environment where
 - i build python from sources
 - install pip with the wheel bundled with python
 - then install things with pip, like Jupyter

That environment is then deployed on various machines, at various
installation folders.

One issue I encounter, is the path to python in scripts like pip,
ipython, jupyter, etc is the original path where python is installed.
On linux, i can just do some sed in the problematic scripts.
On windows however, those scripts are python embedded in an EXE.
Probably generated by the same tool, as they all have a similar size
and a structure of an exe that contains a compressed __main__.py that
launch the relevant python module for the command.

What is the tool that creates those executables, and is there a way to
regenerate them from the python that has been deployed somewhere else,
so they point to the correct final path to python on that machine?
 Since pip is able to create ipython.exe with path to my python
embedded for example, i assume i already have all i need in my python
installation to regenerate them?
-- 
https://mail.python.org/mailman/listinfo/python-list