Bug 220264 - #!/usr/bin/env python -tt doesn't work
Summary: #!/usr/bin/env python -tt doesn't work
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-12-19 23:21 UTC by Scott Tsai
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-12-20 07:58:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Scott Tsai 2006-12-19 23:21:49 UTC
Description of problem:
A file starting with '#!/usr/bin/env python -tt'
does not behave the same when executed as:
python -tt FILE

Version-Release number of selected component (if applicable):
coreutils-5.97-12.2.fc6

How reproducible:
always

Steps to Reproduce:
1. printf '#!/usr/bin/env python -tt\nprint 1\n' > t
2. chmod +x t
3. ./t
4. python -tt t
Actual results:
/usr/bin/env: python -tt: No such file or directory

Expected results:
1

Additional info:
Works on MacOS 10.4, with its FreeBSD derived /usr/bin/env

Comment 1 Jim Meyering 2006-12-20 07:58:47 UTC
When invoking any program via #!, only two things can be on that first line: the
first (everything up to first white space byte) is taken as a program name. 
Everything after that first bit of white space is grouped together as a single
"argument" to that program.  In your case, "python -tt" is interpreted as a
program name, and of course is not found.

Instead, you can do something like this:

cat <<EOF > t
#!/usr/bin/env python
import warnings
warnings.filterwarnings("error", category=SyntaxWarning)
print 1
EOF

Comment 2 Scott Tsai 2006-12-20 11:45:02 UTC
Thanks for the explaination.


Note You need to log in before you can comment on or make changes to this bug.