Comments (17)
Thank you for reporting this. What platform are you on?
-----Original Message-----
From: "Arfrever" [email protected]
Sent: 1/22/2014 9:41 AM
To: "blink1073/oct2py" [email protected]
Subject: [oct2py] oct2py.tests.test_oct2py.test_plot(),oct2py.tests.test_oct2py.test_call_path() errors (#37)
oct2py.tests.test_oct2py.test_plot(), oct2py.tests.test_oct2py.test_call_path() fail with errors with each Python version (2.7, 3.1, 3.2, 3.3).
I use Octave 3.6.4, NumPy 1.8.0, SciPy 0.13.2, IPython 1.1.0, Pexpect 3.0.
ERROR: oct2py.tests.test_oct2py.test_plot
Traceback (most recent call last):
File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
self.test(_self.arg)
File "/tmp/oct2py-1.3.0/oct2py/tests/test_oct2py.py", line 751, in test_plot
octave.plot([1, 2, 3])
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 410, in octave_command
return self.call(name, *args, *_kwargs)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 240, in call
resp = self._eval(cmd, verbose=verbose, timeout=timeout)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 395, in _eval
timeout=timeout)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 650, in evaluate
self.interact(line)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 755, in interact
inp = inp_func() + '\n'
EOFError: EOF when reading a line
ERROR: oct2py.tests.test_oct2py.test_call_path
Traceback (most recent call last):
File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
self.test(_self.arg)
File "/tmp/oct2py-1.3.0/oct2py/tests/test_oct2py.py", line 826, in test_call_path
octave.addpath(os.path.dirname(file))
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 410, in octave_command
return self.call(name, *args, *_kwargs)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 240, in call
resp = self._eval(cmd, verbose=verbose, timeout=timeout)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 395, in _eval
timeout=timeout)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 650, in evaluate
self.interact(line)
File "/tmp/oct2py-1.3.0/oct2py/session.py", line 755, in interact
inp = inp_func() + '\n'
EOFError: EOF when reading a line
Ran 68 tests in 1015.829s
FAILED (errors=2)
—
Reply to this email directly or view it on GitHub.
from oct2py.
Gentoo GNU/Linux, x86-64.
from oct2py.
I am using Anaconda, which does not have Numpy 1.8 available as of yet. I am using Octave 3.6.2, NumPy 1.7.1, SciPy 0.13.1, IPython 1.1.0, Pexpect 3.0. Would you mind trying the following and letting me know what behavior your see?
>>> from oct2py import octave
>>> octave.plot([1, 2, 3])
I suspect you will see an Octave debug prompt.
from oct2py.
It shows 2.0 in Python prompt and a new window with a graph is spawned.
I think that maybe EOFError: EOF when reading a line
is caused by execution of tests in a non-interactive environment with null standard input.
from oct2py.
What confuses me is why you are ending up in _Session.interact
in the first place. I tried cleaning up the debug prompt finder in the latest master branch, would you mind trying again?
from oct2py.
Also, can you give me the test incantation you are using, as well as the version of nose?
from oct2py.
Hi, sorry for jumping in - I'm trying to get the tests running for a gentoo package. I'm working with the latest version 1.3.0. Running the tests with nosetests from the command line works fine.
But not with portage - gentoo's package manager.
See oct2py/session.py line 648:
elif line.endswith('>') and not syntax_error:
line += self.expect(' ')
self.interact(line)
self.write('clear _\n')
resp = resp[:-4]
self.expect('\x03')
continue
When running nosetests from command line, this codeblock is executed only in one test: oct2py.tests.test_oct2py.test_keyboard. The variable "line" has the value "debug>". All tests pass.
When running in the gentoo package manager, this block is executed twice: Called from oct2py.tests.test_oct2py.test_keyboard and oct2py.tests.test_oct2py.test_call_path. The variable "line" has the values "debug>" and ">>". After that the test oct2py.tests.test_oct2py.test_call_path fails with the mentioned EOF error.
Tested with python3.3 and octave-3.6.4.
Can you help me understanding what exactly happens here?
from oct2py.
@cel4, I'm not sure how to reproduce the error. I added a guard for EOFError, but I'm not sure what effect that will have. I still don't understand why you'd be getting dumped into an interactive prompt by Octave in either case.
from oct2py.
@blink1073, since you do not seem to be a gentoo fan you probably can't reproduce this error 👎 I will see if I can understand what goes wrong - but it will probably take some more time.
I have a feeling that these global assignments in the test file might be problematic - but that's just a feeling (tests/test_oct2py.py):
octave = Oct2Py()
octave.addpath(os.path.dirname(__file__))
DATA = octave.test_datatypes()
These three lines of code always work - DATA always has the expected value. However reusing the octave object in tests does not work - at least in the gentoo environment.
so:
def mytest():
# does not work -> weird EOF error
octave.addpath("/path/to/dir")
# works fine
oc = Oct2Py()
oc.addpath("/path/to/dir")
Why exactly do you need this global octave session?
from oct2py.
Great catch, thanks @cel4. It should work fine now.
from oct2py.
@blink1073, yes - this test works now! One more test is failing though:
I've tried to rewrite this one as well:
def test_plot():
oc = Oct2Py()
n = oc.figure()
oc.plot([1, 2, 3])
oc.close_(n)
But this time it won't work:
ERROR: oct2py.tests.test_oct2py.test_plot
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/tests/test_oct2py.py", line 756, in test_plot
oc.plot([1, 2, 3])
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/session.py", line 410, in octave_command
return self.call(name, *args, **kwargs)
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/session.py", line 240, in call
resp = self._eval(cmd, verbose=verbose, timeout=timeout)
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/session.py", line 395, in _eval
timeout=timeout)
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/session.py", line 650, in evaluate
self.interact(line)
File "/var/tmp/portage/dev-python/oct2py-1.3.0-r1/work/oct2py-1.3.0/oct2py/session.py", line 755, in interact
inp = inp_func() + '\n'
EOFError: EOF when reading a line
-------------------- >> begin captured stdout << ---------------------
Entering Octave Debug Prompt...
gnuplot>
--------------------- >> end captured stdout << ----------------------
----------------------------------------------------------------------
Ran 76 tests in 94.526s
Any idea why those commands are printed to stdout instead of being piped to octave?
from oct2py.
I updated the test_plot test function. Does that function work for you outside of the gentoo test runner?
from oct2py.
Yes, runs perfectly fine when invoking nosetests from command line. But that's probably because in the gentoo environment this test somehow ends up in the debug prompt logic - whereas in normal tests the debug code is not touched.
It would probably be helpful for me to understand under what conditions the debug mode is used.
from oct2py.
@blink1073, I think I have found the problem - It's not in your code 👍 I'll report back when everything's fixed.
from oct2py.
Okay, looks like all tests work now.
You might want to patch this though: (test_octavemagic.py)
if not sys.stdin.encoding:
sys.stdin.encoding = 'utf-8' # needed for py.test
encoding seems to be readonly and thus this assignment fails: "AttributeError: readonly attribute".
This tiny patch should fix this problem.
if not sys.stdin.encoding:
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
Thanks so much for your help on this issue. For me this problem is resolved.
from oct2py.
I applied your patch, and am glad you were able to get resolved. Thanks for the feedback and your help in tracking down these bugs.
from oct2py.
I'm calling this one fixed.
from oct2py.
Related Issues (20)
- error: 'upfirdn' undefined near line 121, column 121 HOT 5
- Struct fieldnames that start with number are ignored HOT 1
- Bug: PULL-PUSH-PULL 1D Column vector will convert into 1D Row Vector HOT 4
- push will push Cell HOT 2
- [Question] Properly end session HOT 4
- Using `system ("cat ~/.octaverc")` on Winows HOT 2
- initialization: graphics_toolkit: 2004h toolkit is not available HOT 5
- Run doesn't create new variables in the octave environment HOT 3
- Conflict with opencv HOT 5
- bracketed paste \x1b[?2004h issue HOT 3
- Memory Leak HOT 1
- Problem with calling function; too many outputs HOT 1
- When I use python multiprocessing to open multiple octave displays a timeou HOT 1
- Problem with matlab package folders?
- Thread pool executor leaves ghost-threads that fill up memory
- Calling function script takes 1.5 seconds HOT 1
- error: 'graphics_toolkit' undefined
- Error trying to import octave in Anaconda Spyder using "from oct2py import octave" HOT 8
- _exist function not removing special characters from response HOT 2
- Error on testing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oct2py.