<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 23, 2012 at 11:16 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Sam,<br>
<br>
I've had occasion recently also to be adding frontends to be<br>
auto-discovered.  The way that frontends work is that they are<br>
self-registering classes.  When the class, in this case<br>
ARTIOStaticOutput is defined, the metaclass gets called and this<br>
inserts a reference to the frontend's static output into the known set<br>
of data types.  You're likely seeing this in your run on the command<br>
line for plot.<br>
<br>
I would also guess that things aren't being activated correctly.  What<br>
happens if you manually import it in your script, above yt.mods, and<br>
print it out?  Because printing out a module object will include the<br>
path, this can help us see where thigns might be going wrong.<br>
<br>
import yt.mods; print yt.mods<br>
import yt.frontends.artio.api as artio; print artio<br>
<br></blockquote><div> </div><div style>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. </div>
<div style><br></div><div style>Should have caught that, thanks for all of your help!</div><div style> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

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