
Hi yt-users, I'm having a little trouble with my script environment (for yt-3.0). After installing and then "activating" a new repository (python setup.py develop) I altered mods.py to include a new frontend. When I then run e.g., plot from the command line, yt.mods imports properly and my _is_valid script runs fine. However, when I run "load" from a script my new StaticOutput class isn't found. I guess this is because I have not activated my yt environment properly(?), can anyone tell me what is going wrong? Thanks! Sam PS In case it is helpful: I get an error on load in convenience.py because the my new StaticOutput class (artio) is not defined. Here's the output if I print the c in c._is_valid . <class 'yt.frontends.enzo.data_structures.EnzoStaticOutput'> <class 'yt.frontends.chombo.data_structures.ChomboStaticOutput'> <class 'yt.data_objects.static_output.StaticOutput'> <class 'yt.frontends.athena.data_structures.AthenaStaticOutput'> <class 'yt.frontends.tiger.data_structures.TigerStaticOutput'> <class 'yt.frontends.nyx.data_structures.NyxStaticOutput'> <class 'yt.frontends.orion.data_structures.OrionStaticOutput'> <class 'yt.frontends.flash.data_structures.FLASHStaticOutput'> <class 'yt.frontends.enzo.data_structures.EnzoStaticOutputInMemory'> <class 'yt.frontends.ramses.data_structures.RAMSESStaticOutput'> <class 'yt.frontends.gdf.data_structures.GDFStaticOutput'> <class 'yt.frontends.castro.data_structures.CastroStaticOutput'> yt : [ERROR ] 2012-12-23 14:16:08,197 Couldn't figure out output type for tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art Traceback (most recent call last): File "plot.py", line 3, in <module> pf = load("tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art") File "/Users/sleitner/repos/yt-3.0-clone/yt/convenience.py", line 85, in load raise YTOutputNotIdentified(args, kwargs)

Hi Sam, It difficult to say exactly what's going wrong without looking at how you set up your ARTStaticOutput class. A good way to figure out what's going wrong would be to place a pdb call in the place where the static output registry is created: http://paste.yt-project.org/show/3028/ When I do so, I get the following backtrace for the EnzoStaticOutput class: -> from yt.mods import * /Users/goldbaum/Documents/yt-x86_64/src/yt-3.0-hg/yt/mods.py(70)<module>() -> from yt.frontends.enzo.api import \ /Users/goldbaum/Documents/yt-x86_64/src/yt-3.0-hg/yt/frontends/enzo/api.py(31)<module>() -> from .data_structures import \ /Users/goldbaum/Documents/yt-x86_64/src/yt-3.0-hg/yt/frontends/enzo/data_structures.py(642)<module>() -> class EnzoStaticOutput(StaticOutput):
/Users/goldbaum/Documents/yt-x86_64/src/yt-3.0-hg/yt/data_objects/static_output.py(67)__init__() -> output_type_registry[name] = cls For some reason your ArtStaticOutput class is not being imported along with everything else in yt.mods. Hope that was helpful. Cheers, Nathan On 12/23/12 2:04 PM, Sam Leitner wrote:
Hi yt-users,
I'm having a little trouble with my script environment (for yt-3.0). After installing and then "activating" a new repository (python setup.py develop) I altered mods.py to include a new frontend. When I then run e.g., plot from the command line, yt.mods imports properly and my _is_valid script runs fine. However, when I run "load" from a script my new StaticOutput class isn't found. I guess this is because I have not activated my yt environment properly(?), can anyone tell me what is going wrong?
Thanks!
Sam
PS In case it is helpful: I get an error on load in convenience.py because the my new StaticOutput class (artio) is not defined. Here's the output if I print the c in c._is_valid .
<class 'yt.frontends.enzo.data_structures.EnzoStaticOutput'> <class 'yt.frontends.chombo.data_structures.ChomboStaticOutput'> <class 'yt.data_objects.static_output.StaticOutput'> <class 'yt.frontends.athena.data_structures.AthenaStaticOutput'> <class 'yt.frontends.tiger.data_structures.TigerStaticOutput'> <class 'yt.frontends.nyx.data_structures.NyxStaticOutput'> <class 'yt.frontends.orion.data_structures.OrionStaticOutput'> <class 'yt.frontends.flash.data_structures.FLASHStaticOutput'> <class 'yt.frontends.enzo.data_structures.EnzoStaticOutputInMemory'> <class 'yt.frontends.ramses.data_structures.RAMSESStaticOutput'> <class 'yt.frontends.gdf.data_structures.GDFStaticOutput'> <class 'yt.frontends.castro.data_structures.CastroStaticOutput'> yt : [ERROR ] 2012-12-23 14:16:08,197 Couldn't figure out output type for tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art Traceback (most recent call last): File "plot.py", line 3, in <module> pf = load("tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art") File "/Users/sleitner/repos/yt-3.0-clone/yt/convenience.py", line 85, in load raise YTOutputNotIdentified(args, kwargs)
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Sam, I've had occasion recently also to be adding frontends to be auto-discovered. The way that frontends work is that they are self-registering classes. When the class, in this case ARTIOStaticOutput is defined, the metaclass gets called and this inserts a reference to the frontend's static output into the known set of data types. You're likely seeing this in your run on the command line for plot. I would also guess that things aren't being activated correctly. What happens if you manually import it in your script, above yt.mods, and print it out? Because printing out a module object will include the path, this can help us see where thigns might be going wrong. import yt.mods; print yt.mods import yt.frontends.artio.api as artio; print artio And it may also now be the case that if you manually import it, you can load from it. As a point of reference, one thing I have become accustomed to prefixing all the scripts that absolutely need to run in a particular clone of yt with something like this at the top of the script: import sys sys.path.insert(0, "/home/mturk/yt/yt-3.0") Then you can go on to do stuff like: from yt.mods import * from yt.frontends.sph.api import OWLSStaticOutput pf = load("snapshot_033/snap_033.0.hdf5") Can you have a go at looking into where the modules are coming from, and let us know? As another quick idea, it may be that if you want to move back and forth, you can avoid using "develop" at all and manually set your PYTHONPATH. I keep all of my yt repos in $HOME/yt and I use this alias to switch between them: ppbr() { PP="${HOME}/yt/$1/" if [ ! -d ${PP} ] && echo "${PP} doesn't exist" && return export PYTHONPATH=${PP} #echo "PYTHONPATH=${PYTHONPATH}" export YTPATH=${PP} } It's simple, but it works. -Matt On Sun, Dec 23, 2012 at 5:04 PM, Sam Leitner <sam.leitner@gmail.com> wrote:
Hi yt-users,
I'm having a little trouble with my script environment (for yt-3.0). After installing and then "activating" a new repository (python setup.py develop) I altered mods.py to include a new frontend. When I then run e.g., plot from the command line, yt.mods imports properly and my _is_valid script runs fine. However, when I run "load" from a script my new StaticOutput class isn't found. I guess this is because I have not activated my yt environment properly(?), can anyone tell me what is going wrong?
Thanks!
Sam
PS In case it is helpful: I get an error on load in convenience.py because the my new StaticOutput class (artio) is not defined. Here's the output if I print the c in c._is_valid .
<class 'yt.frontends.enzo.data_structures.EnzoStaticOutput'> <class 'yt.frontends.chombo.data_structures.ChomboStaticOutput'> <class 'yt.data_objects.static_output.StaticOutput'> <class 'yt.frontends.athena.data_structures.AthenaStaticOutput'> <class 'yt.frontends.tiger.data_structures.TigerStaticOutput'> <class 'yt.frontends.nyx.data_structures.NyxStaticOutput'> <class 'yt.frontends.orion.data_structures.OrionStaticOutput'> <class 'yt.frontends.flash.data_structures.FLASHStaticOutput'> <class 'yt.frontends.enzo.data_structures.EnzoStaticOutputInMemory'> <class 'yt.frontends.ramses.data_structures.RAMSESStaticOutput'> <class 'yt.frontends.gdf.data_structures.GDFStaticOutput'> <class 'yt.frontends.castro.data_structures.CastroStaticOutput'> yt : [ERROR ] 2012-12-23 14:16:08,197 Couldn't figure out output type for tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art Traceback (most recent call last): File "plot.py", line 3, in <module> pf = load("tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art") File "/Users/sleitner/repos/yt-3.0-clone/yt/convenience.py", line 85, in load raise YTOutputNotIdentified(args, kwargs)
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

On Sun, Dec 23, 2012 at 11:16 PM, Matthew Turk <matthewturk@gmail.com>wrote:
Hi Sam,
I've had occasion recently also to be adding frontends to be auto-discovered. The way that frontends work is that they are self-registering classes. When the class, in this case ARTIOStaticOutput is defined, the metaclass gets called and this inserts a reference to the frontend's static output into the known set of data types. You're likely seeing this in your run on the command line for plot.
I would also guess that things aren't being activated correctly. What happens if you manually import it in your script, above yt.mods, and print it out? Because printing out a module object will include the path, this can help us see where thigns might be going wrong.
import yt.mods; print yt.mods import yt.frontends.artio.api as artio; print artio
Eek, got it. Thanks for the debugging tips (and advice below)! print yt.mods yielded the wrong repo path... The issue was that I linked my script between clones. It looks like that link was followed for importing yt.mods, but the rest of yt was activated in the correct path. Should have caught that, thanks for all of your help!
And it may also now be the case that if you manually import it, you can load from it.
As a point of reference, one thing I have become accustomed to prefixing all the scripts that absolutely need to run in a particular clone of yt with something like this at the top of the script:
import sys sys.path.insert(0, "/home/mturk/yt/yt-3.0")
Then you can go on to do stuff like:
from yt.mods import * from yt.frontends.sph.api import OWLSStaticOutput pf = load("snapshot_033/snap_033.0.hdf5")
Can you have a go at looking into where the modules are coming from, and let us know? As another quick idea, it may be that if you want to move back and forth, you can avoid using "develop" at all and manually set your PYTHONPATH. I keep all of my yt repos in $HOME/yt and I use this alias to switch between them:
ppbr() { PP="${HOME}/yt/$1/" if [ ! -d ${PP} ] && echo "${PP} doesn't exist" && return export PYTHONPATH=${PP} #echo "PYTHONPATH=${PYTHONPATH}" export YTPATH=${PP} }
It's simple, but it works.
-Matt
On Sun, Dec 23, 2012 at 5:04 PM, Sam Leitner <sam.leitner@gmail.com> wrote:
Hi yt-users,
I'm having a little trouble with my script environment (for yt-3.0). After installing and then "activating" a new repository (python setup.py develop) I altered mods.py to include a new frontend. When I then run e.g., plot from the command line, yt.mods imports properly and my _is_valid script runs fine. However, when I run "load" from a script my new StaticOutput class isn't found. I guess this is because I have not activated my yt environment properly(?), can anyone tell me what is going wrong?
Thanks!
Sam
PS In case it is helpful: I get an error on load in convenience.py because the my new StaticOutput class (artio) is not defined. Here's the output if I print the c in c._is_valid .
<class 'yt.frontends.enzo.data_structures.EnzoStaticOutput'> <class 'yt.frontends.chombo.data_structures.ChomboStaticOutput'> <class 'yt.data_objects.static_output.StaticOutput'> <class 'yt.frontends.athena.data_structures.AthenaStaticOutput'> <class 'yt.frontends.tiger.data_structures.TigerStaticOutput'> <class 'yt.frontends.nyx.data_structures.NyxStaticOutput'> <class 'yt.frontends.orion.data_structures.OrionStaticOutput'> <class 'yt.frontends.flash.data_structures.FLASHStaticOutput'> <class 'yt.frontends.enzo.data_structures.EnzoStaticOutputInMemory'> <class 'yt.frontends.ramses.data_structures.RAMSESStaticOutput'> <class 'yt.frontends.gdf.data_structures.GDFStaticOutput'> <class 'yt.frontends.castro.data_structures.CastroStaticOutput'> yt : [ERROR ] 2012-12-23 14:16:08,197 Couldn't figure out output type for tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art Traceback (most recent call last): File "plot.py", line 3, in <module> pf = load("tests/artdat/sizmbhloz-cl04SNpWRPlc30nPF-rs9_a0.9254.art") File "/Users/sleitner/repos/yt-3.0-clone/yt/convenience.py", line 85, in load raise YTOutputNotIdentified(args, kwargs)
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Matthew Turk
-
Nathan Goldbaum
-
Sam Leitner