File script = FileSystem.open("/tmp/example.py", FILE_WRITE);
script.print("#!/usr/bin/python\n");
script.print("import urllib\n");
script.print("import ast\n");
script.print("r = urllib.urlopen('https://api/fields=transaction_sold_count&api_key=asdfasdfasdf')\n");
script.print("a = r.read()\n");
script.print("y = ast.literal_eval(a)\n");
script.print("b = y[]\n");
script.print("print b"); //should print an int
script.close();
and
File script = FileSystem.open("/tmp/example.py", FILE_WRITE);
script.print("#!/usr/bin/python\n");
script.print("a = 394079273014\n");
script.print("print a");
script.close();
NOTE: Both these scripts are set to be executable and the linux "cat" process shows that they both were input into the python script file without error. They were run with this process:
Process reading;
reading.begin("/tmp/example.py");
reading.run();
String output;
while(reading.available())
{
output += (char)reading.read();
}
Serial.println(output);
The latter, more simple example.py script runs flawlessly and prints to the serial monitor, while the former doesn't output anything. I'm really, really confused by this. I've run them both in my OSX terminal and they both run well there too. Are the imported modules in the former not included with the yun's version of python? Any leads would be appreciated!