On Sun, Jul 20, 2008 at 4:05 PM, William Stein <[EMAIL PROTECTED]> wrote:
>
> On Sun, Jul 20, 2008 at 3:57 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>>
>> On Sun, Jul 20, 2008 at 1:36 PM, William Stein <[EMAIL PROTECTED]> wrote:
>>>
>>> On Sat, Jul 19, 2008 at 10:44 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> when testing sage 3.0.5 using py.test, sage fails to import, because
>>>> it's using input (?) stream's write and flush methods:
>>>
>>> I don't know what py.test is, but do you really need to use the IPython
>>> interface to sage with it?  Instead of running Sage could you do
>>>
>>>   sage -python
>>>
>>> then put
>>>
>>>   from sage.all import *
>>>
>>> or something?     This comment may be completely off, since I
>>> don't know what py.test is.  Hey, what's py.test?
>>
>> http://codespeak.net/py/dist/test.html
>>
>> it used to be the only good testing framework in python, now there is
>> also nosetests:
>>
>> http://www.somethingaboutorange.com/mrl/projects/nose/
>>
>> that is probably better, and the above problem doesn't arise in there.
>> But as usual, nosetests and py.test are not equivalent, so we need to
>> adapt some of our tests first.
>>
>> sage -python doesn't work:
>>
>> $ sage -python /usr/bin/py.test sympy/test_external/test_sage.py
>> Traceback (most recent call last):
>>  File "/usr/bin/py.test", line 9, in <module>
>>    import py
>> ImportError: No module named py
>>
>>
>> You would have to set up paths to the system wide modules first.  I
>> want to use system wide python, not Sage's python.
>
> If you're using the system-wide python why does Sage's copy of
> IPython have anything to do with anything?    I guess I'm basically
> asking why you are having to program around a problem with
> Ipython in order to do some sort of testing with Sage?  For example,
> when Sage's doctests run IPython is never involved at all; it's
> not even imported.

I don't want to have anything in common with ipython, but sage invokes
it on import sage.all, as can be checked easily:

[EMAIL PROTECTED]:~/ext/sage$ . local/bin/sage-env
[EMAIL PROTECTED]:~/ext/sage$ python
Python 2.5.2 (r252:60911, Jul 11 2008, 05:28:36)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sage.all
>>>

Then apply this patch:

--- /tmp/genutils.py    2008-07-20 16:33:15.000000000 +0200
+++ local/lib/python2.5/site-packages/IPython/genutils.py       2008-07-20
16:33:26.553433732 +0200
@@ -54,6 +54,7 @@
         if not hasattr(stream,'write') or not hasattr(stream,'flush'):
             stream = fallback
         self.stream = stream
+        stop
         self._swrite = stream.write
         self.flush = stream.flush



and:

[EMAIL PROTECTED]:~/ext/sage$ python
Python 2.5.2 (r252:60911, Jul 11 2008, 05:28:36)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sage.all
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ondra/ext/sage/local/lib/python2.5/site-packages/sage/all.py",
line 58, in <module>
    from sage.misc.all       import *         # takes a while
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/sage/misc/all.py",
line 15, in <module>
    from sage_timeit_class import timeit
  File "sage_timeit_class.pyx", line 3, in sage.misc.sage_timeit_class
(sage/misc/sage_timeit_class.c:485)
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/sage/misc/sage_timeit.py",
line 12, in <module>
    import timeit as timeit_, time, math, preparser, interpreter
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/sage/misc/interpreter.py",
line 108, in <module>
    from IPython.iplib import InteractiveShell
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/IPython/__init__.py",
line 57, in <module>
    __import__(name,glob,loc,[])
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/IPython/ipstruct.py",
line 22, in <module>
    from IPython.genutils import list2dict2
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/IPython/genutils.py",
line 95, in <module>
    Term = IOTerm()
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/IPython/genutils.py",
line 90, in __init__
    self.cin  = IOStream(cin,sys.stdin)
  File 
"/home/ondra/ext/sage/local/lib/python2.5/site-packages/IPython/genutils.py",
line 57, in __init__
    stop
NameError: global name 'stop' is not defined
>>>



Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to