running python on azure RRS feed

  • Question

  • I am trying to running a python script on azure.

    I added the Python27 (include python implementation and python27.dll) into the WebRole directory.

    Here is my code. It works well on Development Fabric, but when I deployed the application in azure, the python script

    cannot be executed correctly.

    string pythonexe = "Python27\\python.exe";
    string testpy = "";
    string appRoot = Environment.GetEnvironmentVariable("RoleRoot");
    string pathToTestpy = Path.Combine(appRoot + @"\", string.Format(@"approot\{0}", testpy));
    string pathToPythonexe = Path.Combine(appRoot + @"\", string.Format(@"approot\{0}", pythonexe));
    var newProc = new System.Diagnostics.Process();
    newProc.StartInfo.FileName = pathToPythonexe;
    newProc.StartInfo.Arguments = pathToTestpy;
    newProc.StartInfo.UseShellExecute = false;
    newProc.StartInfo.RedirectStandardOutput = true;
    newProc.StartInfo.EnvironmentVariables["PATH"] = Path.Combine(appRoot + @"\",   string.Format(@"approot\{0}", @"Python27");
    resultShow.Text = newProc.StandardOutput.ReadLine();


    Does anybody know the reason? Thank you very much.

    Friday, February 4, 2011 5:10 AM


All replies

  • "cannot be executed correctly" is a bit vague... does the process start?  Is there an exception?  Does the Python script not produce the expected result?
    Saturday, February 5, 2011 3:37 AM
  • Thank you very much.

    I have fixed the problem. My python script "" is to create a file, but there is an error: "IOError: [Errno 13] Permission denied: 'sysout.log' ". So it is not the problem of running python program. But what I should do if I want to create file in azure?

    Saturday, February 5, 2011 12:19 PM
  • You should usually use local storage if you want to create files on the VM's filesystem:

    • Proposed as answer by freaky roach Sunday, February 6, 2011 8:48 PM
    • Marked as answer by dolphin_chen Monday, February 7, 2011 12:49 AM
    Saturday, February 5, 2011 6:59 PM