I have to run a few python scripts and was trying to create a bash script to do it for me. The bash script is as follows:
#!/bin/bash
FILE=$(ls | grep .\.py)
for f in $FILE
do
python2.6 $f
done
And the following error pops up for each of python calls:
SyntaxError: invalid syntax
Traceback (most recent call last):
File "script.py", line 2, in ?
import requests
File "/[some path]/python/local/lib/python2.6/site-packages/requests-2.0.0-py2.6.egg/requests/__init__.py", line 53
from .packages.urllib3.contrib import pyopenssl
Any ideas would help a lot. Thanks for your time.
EDIT:
Output from
import sys
print sys.version
...
2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
for f in *.py?import requestswork fine.$FILEis just there for when I change the directory.