These are chat archives for spyder-ide/public
Hi. I'm having a problem with % commands when I use them in my spyder code.
If I use code " %matplotlib inline " for example I get the following error message:
SyntaxError: invalid syntax
From searching for the solution, it seems that the % is an IPython magic commmand and I would therefore need IPython to use code with this command.
I'm using Spyder 3.7 and can open IPython consoles.
Why then is the code not working???
Any help would be greatly appreciated!
%commands are indeed IPython magics, which are only intended to be used interactively (i.e. typed directly into the IPython console), not in your normal Python code. As they only will work in the IPython interpreter and are not designed to function reliably in non-interactive mode, they should not be used in your scripts or modules, even if they did work.