<div dir="ltr">Instead of "import functions.py", try "import functions"</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"> <br>-------------------------<br>Xuan Choo<div>PhD Candidate<br>
<div>Computational Neuroscience Research Group<br><div><div>Centre for Theoretical Neuroscience, University of Waterloo</div><div>Tel: (519) 888 4567 ext: 38842</div>HP: (226) 339 3892</div></div><div>Office: PAS 2462</div>
</div></div></div>
<br><br><div class="gmail_quote">On Mon, Jul 21, 2014 at 3:12 PM, Brian Krainer <span dir="ltr"><<a href="mailto:bkrainer731@gmail.com" target="_blank">bkrainer731@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">import nef<br>import nps<br>from ca.nengo.math.impl import ConstantFunction<br>import math<br>import random<br>import sys<br>sys.path.append(path_to_functions.py)<br>import functions.py<br></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Jul 21, 2014 at 3:11 PM, Xuan Choo <span dir="ltr"><<a href="mailto:fchoo@cs.uwaterloo.ca" target="_blank">fchoo@cs.uwaterloo.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Brian,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Can you copy & paste the top bit of your code -- the part with all the import statements (you can censor the filepaths if you wish) into the email chain?</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Cheers,</div></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"> <br>-------------------------<br>
Xuan Choo<div><div>PhD Candidate<br><div>Computational Neuroscience Research Group<br><div><div>Centre for Theoretical Neuroscience, University of Waterloo</div><div>Tel: <a href="tel:%28519%29%20888%204567%20ext%3A%2038842" value="+15198884567" target="_blank">(519) 888 4567 ext: 38842</a></div>
HP: <a href="tel:%28226%29%20339%203892" value="+12263393892" target="_blank">(226) 339 3892</a></div>
</div><div>Office: PAS 2462</div></div></div></div></div>
<br><br><div class="gmail_quote"><div>On Mon, Jul 21, 2014 at 3:01 PM, Brian Krainer <span dir="ltr"><<a href="mailto:bkrainer731@gmail.com" target="_blank">bkrainer731@gmail.com</a>></span> wrote:<br></div>
<div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I have a file called 'functions.py' which I am trying to import. At the top of the script with the network I included 'import functions' but I'm getting the error "ImportErro: No Module named functions" when I try to open the script in the nengo workspace. I did what Xuan suggested with sys.path.append, but I still get the same error. Any ideas?<span><font color="#888888"><br>
<br>brian<br></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 21, 2014 at 2:46 PM, Daniel Rasmussen <span dir="ltr"><<a href="mailto:dhrsmss@gmail.com" target="_blank">dhrsmss@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Brian,<br><br></div>What difficulty are you having when importing the file? Could you post the error message? A Nengo script is just a regular Python file, so importing should work the same as anywhere else in Python. One thing to remember is that in Nengo 1.4 everything is running through Jython, so you need to make sure that the module you're importing is Jython compatible.<br>
<br>Daniel<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On 21 July 2014 13:51, Brian Krainer <span dir="ltr"><<a href="mailto:bkrainer731@gmail.com" target="_blank">bkrainer731@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div>Hello,<br><br></div>As I'm sure you know, Python allows users to import other .py files and use functions from those imported files. Is there any way to import my own files in the .py file with the Nengo network? I've been trying to do this but I've been having some difficulties.<br>
<br>Thanks,<br><br></div>Brian<br></div>
<br></div></div>_______________________________________________<br>
nengo-user mailing list<br>
<a href="mailto:nengo-user@ctnsrv.uwaterloo.ca" target="_blank">nengo-user@ctnsrv.uwaterloo.ca</a><br>
<a href="http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user" target="_blank">http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
nengo-user mailing list<br>
<a href="mailto:nengo-user@ctnsrv.uwaterloo.ca" target="_blank">nengo-user@ctnsrv.uwaterloo.ca</a><br>
<a href="http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user" target="_blank">http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user</a><br>
<br></blockquote></div></div></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>