Opened 8 years ago

Closed 5 years ago

#13597 closed defect (fixed)

tutorial: fix hash-bang in section on programming

Reported by: jhpalmieri Owned by: mvngu
Priority: minor Milestone: sage-6.4
Component: documentation Keywords:
Cc: kcrisman Merged in:
Authors: Jeroen Demeyer Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: 99c96af (Commits) Commit: 99c96af9aeab5460ec0a75462786cfbb94f69c86
Dependencies: Stopgaps:

Description

The section in the tutorial on standalone scripts needs some fixing. It suggests writing a script starting with

#!/usr/bin/env sage -python

import sys
from sage.all import *
...

But on sage.math.washington.edu, and probably on other linux systems, /usr/bin/env doesn't handle multiple arguments very well. I think that replacing the first line with #!/usr/bin/env sage should work.

Change History (13)

comment:1 Changed 8 years ago by kcrisman

  • Cc kcrisman added

comment:2 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:6 Changed 5 years ago by jdemeyer

  • Branch set to u/jdemeyer/tutorial__fix_hash_bang_in_section_on_programming

comment:7 Changed 5 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Commit set to 70f7b1c5d206e8627f3d124a28b7083e3a82313a
  • Status changed from new to needs_review

comment:8 Changed 5 years ago by git

  • Commit changed from 70f7b1c5d206e8627f3d124a28b7083e3a82313a to 99c96af9aeab5460ec0a75462786cfbb94f69c86

Branch pushed to git repo; I updated commit sha1. New commits:

99c96aftutorial: fix hash-bang in section on programming

comment:9 Changed 5 years ago by kcrisman

This doesn't fix what is in the description, which is fixed already, I guess. What I don't understand is why you remove the -python, since otherwise there is no need for

from sage.all import *

is there? Maybe I'm missing something.

Last edited 5 years ago by kcrisman (previous) (diff)

comment:10 Changed 5 years ago by jhpalmieri

I think this is the right thing to do. First, we should certainly not advocate #!/usr/bin/env followed by multiple arguments. Second, I just tried the script from the tutorial but with just #!/usr/bin/env sage at the top. It worked fine, but it didn't work if I removed from sage.all import *:

Traceback (most recent call last):
  File "./my_script", line 10, in <module>
    print factor(sage_eval(sys.argv[1]))
NameError: name 'factor' is not defined

comment:11 Changed 5 years ago by jhpalmieri

  • Reviewers set to John Palmieri, Karl-Dieter Crisman

In particular, I'm happy to give this a positive review. Karl-Dieter, any objections?

comment:12 Changed 5 years ago by kcrisman

  • Reviewers changed from John Palmieri, Karl-Dieter Crisman to John Palmieri
  • Status changed from needs_review to positive_review

No objections if it works this way and doesn't otherwise! I didn't do anything useful here so I'm taking my name off, though.

comment:13 Changed 5 years ago by vbraun

  • Branch changed from u/jdemeyer/tutorial__fix_hash_bang_in_section_on_programming to 99c96af9aeab5460ec0a75462786cfbb94f69c86
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.