Pages

Unixbhaskar's Blog

Thursday, March 22, 2012

How to correct a small python code error!!

So, I was building a software which built on python2.6 version and I was exploiting it on CentOS 5.8.But when I ran the script I have come across that the script is throwing error and saying the syntax is invalid!! heck!

Although I have installed python2.6 separately on this box ...then what??

The error is ordinary :



sudo ./w3af_console -f
File "./w3af_console", line 108
rev = 0 if (a == 'HEAD') else -1
^
SyntaxError: invalid syntax


So , as next step I look into the script, which I should have done in first place and I couldn't.The problem lies in the first line of the script..as we all know that the shebang is the guide to system environment where the script are going to be interpreted.It was showing like this


#!/usr/bin/env python


Now I have corrected it ...as the software demands python2.6 ..so below..



#!/usr/bin/env python26



and Voila!!

Ordinary stuff right?? but tricky..might lead into long haul :)

Hope this will help.

Cheers!
Bhaskar