-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The shell's .output command gives an error on OS X + Python 2.7 #117
Comments
From rogerbinns on April 15, 2011 21:38:46 I've been unable to reproduce this on Windows or Linux. My Mac is PPC running 10.3 and I'm trying there but Python 2.7 doesn't compile so I'm having to try older versions. (Incidentally the test suite also tests the shell and requires that .output works correctly in order to do so.) In order to make progress you'll need to provide more debugging. Before changing output use '.exceptions on' which will show exceptions in their gory detail including variables and should help narrow down why this is happening. |
From rogerbinns on April 15, 2011 21:48:46 Ok, I can't test on my Mac because even when I get python to compile SQLite fails to compile as it requires a more recent version of the OS. I could keep trying to work around issues, but a trace from your unspecified environment would be better. |
From rogerbinns on April 15, 2011 22:20:41 I forgot to mention you should the shell's source. You can find it in the download as tools/shell.py When apsw is compiled that file is simplified (whitespace removed) and incorporated into the resulting DLL which means line numbers aren't useful. |
From pasma10@concepts.nl on April 16, 2011 03:41:48 Hello Roger, First here are the versions. And very first please excuse me because the OS version is not 2.3 but 2.4. I hope this has not wasted your time. I'll try to explain how this could happen. PPC G4 I produced the trace of the .output command after setting .exceptions ON. To me it is strange that stdin.flush does not appear. Because that is definitly where the error occurs. That can also be reproduced in the Python interpretor (see http://bugs.python.org/issue11851 ) The trace output is at the bottom. I hope very much that this is reason for a fix. Tnanks anyway, Edzard Pasma $ python -c "from shell import Shell; Shell().cmdloop()" test.db Frame cmdloop in shell.py at line 758 Frame process_complete_line in shell.py at line 2186 Frame process_command in shell.py at line 908 Frame command_output in shell.py at line 1676 <type 'exceptions.IOError'>: IOError(9, 'Bad file descriptor') |
From rogerbinns on April 16, 2011 10:00:44 You keep confusing OS versions and Python versions :-) In any event the only Mac I have runs 10.3 which is why I mentioned that. Thanks for tracking down the problem. As I mentioned in the Python bug tracker the reason why flush is being called on standard input (nominally a ready only descriptor) is because it is a terminal and readline is being used on it which really does involve writing to your input. My fix will be adding a try/except.
Can you please verify everything is okay after doing this? |
From pasma10@concepts.nl on April 16, 2011 11:27:32 I'm happy this will be solved. The .output command is very useful also if the shell is used embedded in Python. This may produce SQL reports with minimal programming effort. |
From rogerbinns on April 16, 2011 21:11:29 Fixed in rf72362b0f6ca Status: Fixed |
From pasma10@concepts.nl on April 15, 2011 15:29:02
What steps will reproduce the problem? 1.python -c "from apsw import main; main()"
2..output test.out 3. What is the expected output? What do you see instead? Expected is that the output of queries is redirected to the file.
But the command raises IOError, {Errno 9] Bad File Descriptor What version of the product are you using? On what operating system? APSW 3.7.5- r1 Python 2.7
OS/X PPC Please provide any additional information below. The error results from sys.stdin.flush(). I added this in the Python Issue tracker but it is not considered a bug there. (see http://bugs.python.org/issue11851 for more details)
Original issue: http://code.google.com/p/apsw/issues/detail?id=117
The text was updated successfully, but these errors were encountered: