What's the difference between these two python scripts?
code: [select]
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 int
script.close();
and
code: [select]
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 set executable , linux "cat" process shows both input python script file without error. run process:
code: [select]
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 , prints serial monitor, while former doesn't output anything. i'm really, confused this. i've run them both in osx terminal , both run there too. imported modules in former not included yun's version of python? leads appreciated!
at mac terminal:
password: arduino
please test @ linino console. post error code here.
code: [select]
ssh root@arduino.local
password: arduino
please test @ linino console. post error code here.
Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > What's the difference between these two python scripts?
arduino
Comments
Post a Comment