pymad / cpymad

cPyMAD is a python interface to Mad-X using cython and libmadx
http://cern.ch/pymad
Apache License 2.0
3 stars 3 forks source link

name clash of package variables and module names #57

Closed coldfix closed 10 years ago

coldfix commented 10 years ago

I just realized that the name clash of package variables and module names in cern.cpymad has some unpleasant consequences:

>>> import cern.cpymad.madx as m
>>> m
<class 'cern.cpymad.madx.Madx'>

I also suspect that this name clash is the reason for various import problems I had in the past (c.f. 459897b). Note, that the behaviour changes, if the submodule is first imported after the package variable is defined (it will be overwritten, then).

The only way to fix is, is to either rename the .madx module or the variable madx inside the cern.cpymad package. Both of these are not fully backward compatible.

coldfix commented 10 years ago

I think, that it's probably better to rename the constructor functions rather than the submodules. I attached a small PR to this issue.

coldfix commented 10 years ago

Do you have any idea, why this test fails? It runs fine on all other machines, on Travis and on my local machine in all python{2.6,2.7.3.3} and pypy.

For me it looks like the files of the cpymadfolder have not been updated.

Or maybe a more likely explanation: there is an installed version of pymad on the machine which prevents the local files from being imported. I imagine this can happen if relying on custom PYTHONPATH extensions rather than using a virtualenv.

Eothred commented 10 years ago

This is my work desktop, which in principle I don't have access to anymore (as soon as a new employee takes over this machine). You can safely ignore the tests from that machine from now on. I think as well that it most likely picks up an installed pymad instead of testing the new one.