SyntaxError: invalid syntax

cwentz
Level 3
SyntaxError: invalid syntax

I ran my code in Jupyter Notebook and wrote my recipe back. Now on the code page, after clicking validate, I get a SyntaxError: invalid syntax for line 8.

 

%pylab inline

 

Screen Shot 2022-11-02 at 9.34.07 AM.png


Operating system used: MacOS Monterey 12.6

โ€ƒ

0 Kudos
1 Reply
MiguelangelC
Dataiker

Hi,

'%pylab' is a magic function in Jupiter notebooks. Magic functions define shortcuts for a series of actions. In this particular case, it triggers the import of various modules within Matplotlib.

However, magic functions will not work outside of a notebook, which is why the code recipe shows a syntax error.

The solution here is to remove the '%pylab inline' line from the code recipe.

0 Kudos