Whenever I use the function pylab.plot(), it causes spyder to crash and show an error
This is the code I'm using:
def myplot():
x = ([1,2,3],[2,4,6])
pylab.plot(x)
This is the error message I've got:
Error Message
My friends are running the exact same code without an error - I can't work out what I'm doing wrong?
Every time this happens I have to open a new console to make spyder even function which needless to say is extremely irritating.
I'd appreciate any help, thank you,
Ben
Related
I am trying to build a Chatbot using Jupyter Notebook on Google Colab. I am using IPython Markdown to better segregate the user conversations. User will key in their message using input() while the bot responses are IPython display(markdown()).
I am facing issues when i tried to print a starting messages (bot output before a user input). This error occurs approximately 50% of the time I run the script. No errors are faced if I did not print out the starting message. I have tried restarting the kernel but to no avail.
Does anyone know what is the reason for this and how I can fix it?
This is an example of a successful case.
This is an example of a failed case. As you can see, the code is running indefinitely on the input() line.
This is the sample code, where input() box does not pop up at times.
from IPython.display import Markdown, display
display(Markdown("*Alex:* Hello."))
input(">> You: ")
This seems to be a kind of bug in Jupyter notebook, described in the past years by many programmers. I was facing the same problem. After several tests I have found (at least in my code) that the problem disappears if print() functions are removed before input().
I'm trying to debug a circuitpython program (that's running on a microcontroller) and I would like to know if there's a simple way to get the program to drop into the REPL upon a crash/termination while preserving the variables and functions defined in the script.
If this was a regular python program I would simply run it with the "interactive" option of the interpreter set : python -i my_code.py and then have access the variables and function defined in my code for easy debugging.
Instead what I get right now is: after a crash I get prompted to press a key to enter the REPL but the memory is cleared from any trace of my previously running code.
A somewhat cumbersome way to achive an equivalent behaviour, that only works if the code terminates and doesn't crash, is to proceed as follows :
Upload the code
Code will start running automatically
Interupt the code with a keyboard interupt
Press a key to get to the REPL
Import all from the code from the REPL by typing in:
from code import *
Wait for the code to terminate
Finally debug
Rince and repeat for each bug you find...
im new at python and im making a software with tkinter lib. The program works fine but when i close the program it appears the error presented in the title. Depending on what ive oppened from the software the block shown in the error changes.
Does anyone knows what this error means, and can I ignore it? It only appears when i close the program.
Thanks
I'm trying to use PyAutoGui's image recognition functions. (OS X)
Needless to say, I'm running into some slight issues that I can't seem to solve myself no matter where I look or what I do. I'm attempting to have PyAutoGui click on the Chrome shortcut based off a .png screenshot saved to my desktop.
Here's my code in terminal:
>>>import pyautogui
>>>chrome = pyautogui.locateOnScreen('/Users/ianscalzo/Desktop/chrome.png")
>>>
I get no backfire on my filepath, but it causes my shell/terminal to return nothing but go to a new line. (As shown in the code example above - Just causes terminal to go to a blank ">>>")
I don't really understand why it doesn't do anything but go to a new line, so any insight would be greatly appreciated.
Thank you so much!
After struggling with this forever also, finally figured out that you either use command line to take the screenshot or using the screenshot button with windows key. It doesn't work with the snipping tool.
so try:
image = pyautogui.screenshot()
image.save('testing.png')
Go and crop testing.png as small as possible so that locateOnScreen works faster. Then go back to the terminal and type:
pyautogui.locateOnScreen('testing.png')
I have recently started to learn Python 3 and have run into an issue while trying to learn how to debug using IDLE. I have created a basic program following a tutorial, which then explains how to use the debugger. However, I keep running into an issue while stepping through the code, which the tutorial does not explain (I have followed the instructions perfectly) nor does hours of searching on the internet. Basically if I step while already inside a function, usually following print() the debugger steps into pyshell.py, specifically, PyShell.py:1285: write() if i step out of pyshell, the debugger will simple step back in as soon as I try to move on, if this is repeated the step, go, etc buttons will grey out.
Any help will be greatly appreciated.
Thanks.
pyshell.py file opens during the debugging process when the function that is under review is found in Python's library - for example print() or input(). If you want to bypass this file/process click Over and it will step over this review of the function in Python's library.
In Python 3.4, I had the same problem. My tutorial is from Invent with Python by Al Sweigart, chapter 7.
New file editor windows such as pyshell.py and random.pyopen when built-in functions are called, such as input(), print(), random.randint(), etc. Then the STEP button starts stepping through the file it opened.
If you click OVER, you will have to click it several times, but if you click OUT, pyshell.py will close immediately and you'll be back in the original file you were trying to debug.
Also, I encountered problems confusing this one--the grayed-out buttons you mentioned--if I forgot to click in the shell and give input when the program asked. I tried Wing IDE and it didn't run the program correctly, although the program has no bugs. So I googled the problem, and there was no indication that IDLE is broken or useless.
Therefore, I kept trying till the OUT button in the IDLE debugger solved the problem.