Re: Problems including maths library from within Spyce
"Jonathan Ellis" <[email protected]> Thu, 14 Sep 2006 08:53:01 -0700
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
your code gets compiled into a method called spyceProcess; you can see this with spyceCmd.py -c "import * is not allowed in function 'spyceProcess' because it contains a nested function with free variables" this is a Python limitation. either don't use import *, or put your functions that use import * in a library somewhere (project/lib/ if you created it with spyceProject) and import that instead. -Jonathan On Thu, 14 Sep 2006 13:36:13 +0200 (CEST), "Marcus Hoechstetter" <[email protected]> said: > [[\ > from math import pi > > def printPi(): > print pi > > printPi() > ]] > > this works perfectly > > [[\ > from math import * > > def printPi(): > print pi > > printPi() > ]] > > whereas this causes the following error: > > > Python syntax error at index.spy:8 - import * is not allowed in function > 'spyceProcess' because it contains a nested function with free variables > from math import * > > Anyone got an idea? > > Thanx in advance > > Marcus > > > > > > > --------------------------------- > Yahoo! Messenger - kostenlos* mit Familie und Freunden von PC zu PC > telefonieren. -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642