<div dir="ltr">Ray,<div><br></div><div>If you import a module with a certain name, you must reference its functions with that name as well. Since 'import Nio' is how the module was intended to be imported, the instructions are to use that. Since you've imported PyNIO, you would have to use 'PyNIO.open_file(....)' to use things from the PyNIO module. Alternatively, you can do 'import PyNIO as Nio' to create an alias with which you can refer to the module - this would allow your 'Nio.open_file(...)' statements to work as you've written them.</div><div><br></div><div><br></div><div>Kyle</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 15, 2016 at 7:06 AM Ray Hawthorne <<a href="mailto:frontogenesis@gmail.com">frontogenesis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Good morning Dave,<div><br></div><div>Unfortunately, that does not work.</div><div><br></div><div>Here’s what I get back when importing Nio:</div><div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">>>> import Nio</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Traceback (most recent call last):</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> File "<stdin>", line 1, in <module></div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> File "/Users/frontogenesis/anaconda2/lib/python2.7/site-packages/PyNIO/Nio.py", line 63, in <module></div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> from nio import *</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">ImportError: dlopen(/Users/frontogenesis/anaconda2/lib/python2.7/site-packages/PyNIO/nio.so, 2): Library not loaded: @rpath/libgssapi_krb5.2.2.dylib</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> Referenced from: /Users/frontogenesis/anaconda2/lib/python2.7/site-packages/PyNIO/nio.so</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> Reason: image not found</div></div><div><br></div><div><br></div><div>Here’s what I get when importing PyNIO (success), but try to open the file (not successful):</div><div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">>>> import PyNIO</div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">>>> f = Nio.open_file("href.t06z.prob.f36.grib2")</div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Traceback (most recent call last):</div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> File "<stdin>", line 1, in <module></div><div style="margin:0px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">NameError: name 'Nio' is not defined</div></div></div><div style="word-wrap:break-word"><div><br></div><div>-Ray</div></div><div style="word-wrap:break-word"><div><br></div><div><div><blockquote type="cite"><div>On Mar 14, 2016, at 11:19 PM, David Brown <<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>> wrote:</div><br><div><div>The standard way to import PyNIO is simply:<br><br>import Nio<br><br>f = Nio.open_file(<filename>)<br><br>Let us know if that doesn't work.<br> -dave<br><br><br><br><br><br>On Mon, Mar 14, 2016 at 9:10 PM, Ray Hawthorne <<a href="mailto:frontogenesis@gmail.com" target="_blank">frontogenesis@gmail.com</a>> wrote:<br><blockquote type="cite">Greetings,<br><br>I just installed PyNIO from anaconda and I’m having some trouble reading in a grib2 file.<br><br>Using the documentation, when I do an import into my Python script:<br>import Nio<br><br>The import fails to occur.<br><br>I dug around in the anaconda subdirectories and tried:<br>import PyNIO<br>And that import statement works just fine.<br><br>However, when I go to open a grib file:<br>f = Nio.open_file("href.t06z.prob.f36.grib2”)<br>I end up getting a traceback.<br><br>(Similar issue with importing PyNio.Nio as Nio)<br><br>I suspect there’s a discrepancy between the documentation and the build of PyNIO from anaconda — but I’m somewhere in the advanced beginner stage when it comes to Python in general, so I’m not sure how I might be able to fix this so that I can open the grib file with pynio. Would someone be able to point me in the right direction?<br><br>Thanks,<br><br>Ray Hawthorne<br>_______________________________________________<br>pyngl-talk mailing list<br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/pyngl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a><br></blockquote></div></div></blockquote></div><br></div></div>_______________________________________________<br>
pyngl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/pyngl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a><br>
</blockquote></div>