ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 07 Jun 2016 09:29:42 +0200Standalone Python/Sage Scriptshttps://ask.sagemath.org/question/33685/standalone-pythonsage-scripts/The tutorial example from
http://doc.sagemath.org/html/en/tutorial/programming.html#standalone-python-sage-scripts
is working only for integers. It does not work for symbolic expressions. It becomes working by renaming the script from "factor" to "factor.sage" and replacing the last line by
print factor(sage_eval(sys.argv[1],locals={'x':x}))
Is there anything wrong in my configuration of Sage?Klaus ScheicherTue, 07 Jun 2016 09:29:42 +0200https://ask.sagemath.org/question/33685/python/sage scriptshttps://ask.sagemath.org/question/9407/pythonsage-scripts/First of all, my apologies for being a noob and a windows user. I'm using sage in virtualbox. I'm at this part of the tutorial: sagenb.org/doc/live/tutorial/programming.html#standalone-python-sage-scripts
I'm having 2 problems:
(1) I can't execute "./factor 2006". It says "no such file or directory", but the file is definitely there, and "sage -python factor 2006" works.
(2) factoring polynomials doesn't seem to work for me in sage. If I call factor on a string I get a TypeError: "unable to factor n".
**Edit**: Part of the problem may have been that the script was in a shared folder in VirtualBox. Here is some exact input/output, working completely locally (this changes the error in (2)).
`>./factor 2006`
`/usr/bin/env: sage -python: No such file or directory`
`>sage -python factor "32*x^5-1"`
`NameError: name 'x' is not defined`
Any assistance is much appreciated!rmp251Tue, 09 Oct 2012 16:52:29 +0200https://ask.sagemath.org/question/9407/