Spyder + PythonXY - Python Interpreter and IPython OUTPUT issues - no output - python

In Spyder (installed together with PythonXY) on a win 8 64 bit machine, both the Python interpreter and the IPython interpreter have output issues.
The first one, gives output at first but as soon as I run some particular code, it doesn't anymore. I noticed the issue happens easily if I get some error messages first, or if I use ipdb, but not only. Even with some code that run smoothly, it happens that it stops giving output afterward.
IPython is opened in a dedicated IPython console tab, although it's kernel opens a window in the console tab (this did not happen to me with previous versions of spyder and it all opened in the console tab). I need to input commands to the interpreter in the IPython console tab window, but the output is sent to the console tab window instead. Very annoying.
Anybody having the same issues? Solutions?
Thanks a lot!
Edit for Carlos Cordoba:
So, for example, in the normal Python interpreter I do:
import module
module.method1(par1)
where method1 has no errors in it. The method works fine and I get the right output. If I try method2 which contains an error, I get no output.
module.method2(par2)
After this, I get no output at all for any code I right. I have to restart the kernel.
I could not reproduce the same behavior right away on the "IPython console" window. It displays the error message correctly and the output keeps coming out correctly. However, if I use ipdb there, the output goes to the Kernel window instead of the console window, which is inconvenient.
Thank you!

Related

Python program crashes when opening from installer, but not if script is run from Spyder IDE

something weird is going on. I have created a program with PyQt that when opened in Spyder works flawlessly. However if I create the installer with Pyinstall and run it, the program opens normally but once I click on a cell of a table from the main window, it crashes (so I think it has to do with the mousePressEvent() method?
Is there a way where I can debug it, or know where the error is exactly? Because when it crashes the only thing I get is a message of 'Python has stopped working'.
I do have some try blocks around the code and as I said, when opened from the IDE the whole program works as expected.
Please let me know if you need more info
Thanks
EDIT: For a bit more context, if I put the whole mousePressEvent() method in a try block it will still crash when I click the on a cell of the table
Have you include your external resource (like a image) in PyInstaller with the right path folder ? like in this link and have adapt your code ? https://pythonhosted.org/PyInstaller/spec-files.html#adding-data-files ?

PyCharm, stop the console from clearing every time you run the program

So I have just switched over from Spyder to PyCharm. In Spyder, each time you run the program, the console just gets added to, not cleared. This was very useful because I could look through the console to see how my changes to the code were changing the outputs of the program (obviously the console had a maximum length so stuff would get cleared eventually)
However in PyCharm each time I run the program the console is cleared. Surely there must be a way to change this, but I can't find the setting. Thanks.
In Spyder the output is there because you are running iPython.
In PyCharm you can get the same by pressing on View -> Scientific Mode.
Then every time you run you see a the new output and the history there.

PyDev: Running code to interactive console

As my problem is quite simple I'll try to make this question simple aswell. The problem I'm having concerns the PyDev interactive console. I can bring up the console just fine without problems, and even use it as an interactive shell, just as I would be able to with IDLE. However, when I try to run my code that I've written in my project module, it won't run to the interactive console, but to the Eclipse default console. The default console displays the program just fine, but since it's not an interactive shell, I can't do anything afterwards.
With that being said, my question is: How do I get my code to run to the PyDev interactive console, and not the Eclipse default one? Thanks in advance!
For making the symbols of the current editor available in the interactive console, use Ctrl+Alt+Enter (which will do a runfile in the interactive console context).
Also, make sure you read: http://www.pydev.org/manual_adv_interactive_console.html
First it is possible. Second, off top of my head it might be you need to change in preferences where the debug perspective points to? Look through pydev preferences too. Sorry not to be more helpful. Away from computer.
Run the program from the code window. Try hitting F9 whike cyrsor in your code window. Results and bugs should show up in console.

Python Spyder: breakpoints working only once in a blue moon

I use Spyder 2.3.5.2 on an Anaconda Python installation running on Windows 7 64 bit.
The debug functionalities are very temperamental and unreliable. My breakpoints are often completely ignored. Sometimes applying the IT approach (closing and restarting the program) solves the issue, but more often than not it doesn't.
Some forums recommend running the program in the current ipython console, but that doesn't help, either.
Is there anything I can do?
Thanks.
I could not get Sypder to stop at break points (inserted with f12). But then in reading the docs I realized I needed to switch to debug mode (Ctrl-f5 or Debug->Debug). This switches the IPython console prompt to:
ipdb>
Once in this mode, break statements work.

.Spyder opens a figure instead of absence of plt.show()

I actually know a problem in Spyder. When I Work with matplotlib.pyplot, it automatically shows the figure without any kind of plt.show(). So when I make many different figures, it always shows them all on the same.
I've recently made a program, which is saving one figure by iteration in an for loop, it also opens a figure and at the end, the loop crashes before ending because of too many figures showed.
I would like to know if someone also knows such problems, because I've encountered the in many computers running spyder
You likely are running in iPython with Spyder. iPython automatically runs plt.show(). Press f6 (default), and see if "execute in current python or iPython console" is selected. If so, check the console, the 'tab' should show a blue icon with "iP" and have 'kernal' (or similar) following it.
Simple fix: switch to "execute in dedicated python console" or open a new python console (tab header "python 1")
Source: had same problem.

Categories