views:

169

answers:

2

Hi

I have a bash shell script which calls some python scripts. I am running windows with cygwin which has python in /usr/bin/python. I also have python and numpy installed as a windows package. When I execute the script from cygwin , I get an ImportError - no module named numpy. I have tried running from windows shell but the bash script does not run. Any ideas? My script is below

for target in $(ls large_t) ;  
do 
./emulate.py $target ;  #
done | sort | gawk '{print $2,$3,$4,$5,$6 > $1}{print $1}' | sort | uniq > frames

#frames contains a list of filenames, each files name is the timestamp 
rm -f video
touch video

# for each frame
for f in $(cat frames)
do
./make_target_ant.py $f 
cat $f.bscan >> video 
done

Thanks

A: 

The NumPy installed is for the Windows Python, not the cygwin Python. Install NumPy from source built against the cygwin Python, or install it from the cygwin setup if it exists there.

Ignacio Vazquez-Abrams
+2  A: 

Windows python and Cygwin Python are independent; if you're using Cygwin's Python, you need to have numpy installed in cygwin.

If you'd prefer to use the Windows python, you should be able to call it from a bash script by either:

  • Calling the windows executable directly:
    c:/Python/python.exe ./emulate.py
  • Changing the hash-bang to point at the Windows install:
    #!c:/Python/python.exe in the script, rather than #!/usr/bin/env python or #!/usr/bin/python.
  • Putting Windows' python in your path before Cygwin python, for the duration of the script:
    PATH=c:/Python/:$PATH ./emulate.py
    where emulate.py uses the /bin/env method of running python.
Andrew Aylett
Thanks Andrew, you are a star
mikip