Hello,

I am executing a python script from django as described below.

def executeScript(request):
    '''
    View to execute script from web interface
    '''
    print "Execute script view called"
    basepath =  os.path.dirname(os.path.abspath(__file__))
    filepath = basepath + os.path.sep + "script" + os.path.sep +
"dataintegrator.py"
    argpath = basepath + os.path.sep + "script" + os.path.sep + "urls.txt"
    print "FilePath : " + filepath
    print "ArgPath : " + argpath

    test = subprocess.call(["python", filepath, argpath])
    print "###########Result of execution is : " + str(test)
    return HttpResponseRedirect("webadmin")

Here in above code, dataintegrator.py is a script that I am executing from
django web. Now code in a script opens a file called "maps.txt" which is
also in same directory as dataintegrator.py. When I execute script from
command line it can read file but execution from web interface gives
exception.

IOError: [Errno 2] No such file or directory: 'maps.txt'

Even the maps.txt file exists in same directory and script runs fine from
command line than what is the problem with web interface. Anyone knows the
solution ?


Regds,
*Malhar Vora*
http://about.me/malhar.vora

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFA4AP-85pHuCFudKp04QpK5110PV7aAKQ6xxQuC%2BRogJKpU8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to