[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Weird pyton/eshell quirk
From: |
Guido Van Hoecke |
Subject: |
Weird pyton/eshell quirk |
Date: |
Sat, 07 Feb 2015 18:57:08 +0100 |
Hi,
Just stumbled on some weird behavior of eshell when running a python
script.
Script 'silly' just shows MySQLdb version info. It has a shebang line
to be run with python. It runs fine, whether called as './silly' or as
'python ./silly'. When copied to an 'addPlaces' file, it no longer
runs unless called as 'python ./addPlaces'. It puzzles me why eshell
runs './silly' and barks on './addPlaces'. They are exact copies!
Here's the eshell transcript:
$ which python
/usr/bin/python
$ ls -la ./silly
-rwxr-xr-x 1 guivho wheel 65 2015-02-07 18:25 ./silly
$ cat ./silly
#!/usr/bin/python
import MySQLdb as mdb
print mdb.version_info
$ ./silly
(1, 2, 4, 'beta', 4)
$ python ./silly
(1, 2, 4, 'beta', 4)
$ cp silly addPlaces
$ ./addPlaces
Traceback (most recent call last):
File "./addPlaces", line 3, in <module>
import MySQLdb as mdb
ImportError: No module named MySQLdb
$ python addPlaces
(1, 2, 4, 'beta', 4)
This weird behavior occurs with other names, such as 'place',
'places', 'plaats' etc, but not with e.g. 'car', 'cars' or
'incredible'.
There must be a reason why this happens, but I don't get it.
Any suggestion, anyone?
TIA,
Guido
- Weird pyton/eshell quirk,
Guido Van Hoecke <=