OpenOpt install

dmitrey dmitrey.kroshko at scipy.org
Tue Dec 18 12:51:28 EST 2007


thank you, I'll try to fix the issue when I'll have more time, I'm
short of the one for now because of some other urgent work.
D.

On Dec 18, 10:53 am, Robert Kern <robert.k... at gmail.com> wrote:
> dmitrey wrote:
> > When earlier OpenOpt versions had been installed there were no
> > compiled pyc-files (in destination directory). I called to mailing
> > list but no obvious receipt had been achieved. Matthieu had done some
> > changes but it yielded other mistakes (no some py-files detected or
> > kind of), so I had removed those changes and write my own, for to have
> > OO py-files being compiled when installed, because next time when they
> > will be run user may not have root permissions, so he will recompile
> > source files each time OO starts.
>
> Well, the problem there is that you have put code into subdirectories that
> aren't packages. Then you manually add the directories to sys.path when you
> import scikits.openopt.oo . This is a bad thing to do for several reasons; one
> reason is that you don't get the correct .pyc files.
>
> You need to make the directory structure match the package structure. For
> example, you currently have the module scikits.openopt.LP in
> scikits/openopt/Kernel/LP/LP.py . You have two options:
>
>   * you can make the directory structure match the package structure by moving
> the files to the correct location:
>
>     $ mv scikits/openopt/Kernel/LP/LP.py scikits/openopt/LP.py
>
>   * you can make the package structure match the directory structure by adding
> __init__.py files to the subdirectories and changing the imports to match:
>
>     $ touch scikits/openopt/Kernel/__init__.py
>     $ touch scikits/openopt/Kernel/LP/__init__.py
>     $ vim scikits/openopt/oo.py
>       # 1. Delete the sys.path munging.
>       # 2. Change "from LP import LP as CLP" to "from Kernel.LP import LP as CLP"
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>  that is made terrible by our own mad attempt to interpret it as though it had
>  an underlying truth."
>   -- Umberto Eco




More information about the Python-list mailing list