From: Richard M. <mu...@cd...> - 2012-10-30 04:46:37
|
Thanks for the extra info. I'll see if I can implement this (and install python3 so that I can test locally). Will take until this weekend or possibly early next week (unless someone else wants to take a cut at it -:). -richard On 29 Oct 2012, at 13:53 , Dale Lukas Peterson <haz...@gm...> wrote: > Richard, > I am running Python 3.2. In order to run python control, I have to > use the 2to3 tool to convert on each .py file. It fixes things like > print "x" by changing it to print("x"). For some reason, it is > changing the import statements in both xferfcn.py and statesp.py from: > > import statesp > import xferfcn > > to: > > from . import statesp > from . import xferfcn > > Then when try to import control, I get the same error as before: > --------------------------------------------------------------------------- > ImportError Traceback (most recent call last) > <ipython-input-1-4964879682bf> in <module>() > ----> 1 import control > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py > in <module>() > 58 # Import functions from within the control system library > 59 #! Should probably only import the exact functions we use... > ---> 60 from .bdalg import series, parallel, negate, feedback > 61 from .delay import pade > 62 from .dtime import sample_system > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py > in <module>() > 53 > 54 import scipy as sp > ---> 55 from . import xferfcn as tf > 56 from . import statesp as ss > 57 > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py > in <module>() > 82 from .lti import Lti, timebaseEqual, timebase, isdtime > 83 from warnings import warn > ---> 84 from . import statesp > 85 > 86 class TransferFunction(Lti): > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py > in <module>() > 83 import warnings > 84 from .lti import Lti, timebaseEqual, isdtime > ---> 85 from . import xferfcn > 86 > 87 class StateSpace(Lti): > > ImportError: cannot import name xferfcn > > I think this may stem from how src/__init__.py and each of the modules > in src/ are importing each others functionality. The design patterned > that I have been following and have used with no issues in the sympy > project can be seen in these two files: > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/__init__.py > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/particle.py > > Basically, in each module, we set the __all__ list to include the > names of the publicly available class and functions. Within each > module, we never do relative imports, we always use the absolute > import syntax. The __init__.py file is heavily commented so you > should be able to see how we make those symbols available when people > import the module or sub-package. > > Luke > > > > On Sat, Oct 27, 2012 at 4:54 PM, Richard Murray <mu...@cd...> wrote: >> Both of these issues should now be fixed in the latest version of trunk. Let me know if you continue to have problems. >> >> -richard >> >> On 25 Oct 2012, at 23:58 , Dale Lukas Peterson <haz...@gm...> wrote: >> >>> In src/lti.py, NoneType is being imported and used in the Lti class in >>> two locations. Is there a reason this can't be just None? NoneType >>> is deprecated in Python3 and this is causing issues for me. >>> >>> Also, I am getting this import error when I import control: >>> --------------------------------------------------------------------------- >>> ImportError Traceback (most recent call last) >>> <ipython-input-1-4964879682bf> in <module>() >>> ----> 1 import control >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py >>> in <module>() >>> 58 # Import functions from within the control system library >>> 59 #! Should probably only import the exact functions we use... >>> ---> 60 from .bdalg import series, parallel, negate, feedback >>> 61 from .delay import pade >>> 62 from .dtime import sample_system >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py >>> in <module>() >>> 53 >>> 54 import scipy as sp >>> ---> 55 from . import xferfcn as tf >>> 56 from . import statesp as ss >>> 57 >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py >>> in <module>() >>> 82 from .lti import Lti, timebaseEqual, timebase, isdtime >>> 83 from warnings import warn >>> ---> 84 from . import statesp >>> 85 >>> 86 class TransferFunction(Lti): >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py >>> in <module>() >>> 83 import warnings >>> 84 from .lti import Lti, timebaseEqual, isdtime >>> ---> 85 from . import xferfcn >>> 86 >>> 87 class StateSpace(Lti): >>> >>> ImportError: cannot import name xferfcn >>> >>> I noticed that xferfcn.py has: >>> from . import statesp >>> >>> and that statesp.py has: >>> from . import xferfcn >>> >>> I am guessing is a circular dependency issue. From what I can tell, >>> each of these modules only imports these to do some type checking of >>> arguments. >>> >>> Luke >>> >>> >>> -- >>> “People call me a perfectionist, but I'm not. I'm a rightist. I do >>> something until it's right, and then I move on to the next thing.” >>> ― James Cameron >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_sfd2d_oct >>> _______________________________________________ >>> python-control-discuss mailing list >>> pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >> >> >> ------------------------------------------------------------------------------ >> WINDOWS 8 is here. >> Millions of people. Your app in 30 days. >> Visit The Windows 8 Center at Sourceforge for all your go to resources. >> http://windows8center.sourceforge.net/ >> join-generation-app-and-make-money-coding-fast/ >> _______________________________________________ >> python-control-discuss mailing list >> pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > > -- > “People call me a perfectionist, but I'm not. I'm a rightist. I do > something until it's right, and then I move on to the next thing.” > ― James Cameron > > ------------------------------------------------------------------------------ > The Windows 8 Center - In partnership with Sourceforge > Your idea - your app - 30 days. > Get started! > http://windows8center.sourceforge.net/ > what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |