Giter VIP home page Giter VIP logo

Comments (3)

aroberge avatar aroberge commented on August 25, 2024

there's an infinity of ways to SyntaxError, trying to handle them all may not be a sane idea... tell me :)

Given the original goal I had in mind and seeing how much further I have gone with no obvious end in sight ..., it is legitimate to question my sanity! ;-)

For SyntaxError: invalid syntax cases, I have adopted the following approach:

  1. Try to identify what looks like common mistakes; (one of) the first one(s) was your suggestion to identify copy-pasted code that contained a prompt.
  2. Keep an eye out for any questions on Reddit, StackOverflow, etc., that I come accross with similar errors.
  3. Try to identify "simple typos" where the addition, substitution or deletion of a single token would yield some valid code.
>>> print(1/2) =

Traceback (most recent call last):
  File "<friendly-console:3>", line 1
    print(1/2) =
                     ^
SyntaxError: invalid syntax
>>> s = _get_statement()
>>> s.bad_token
type=54 (OP)  string='='  start=(1, 11)  end=(1, 12)  line='print(1/2) =     \n'
>>>

If I reproduced the essence of this example correctly, I should have been able to identify and fix it. Checking my code, I have not yet considered deleting tokens, which appears to be the problem in this case (extra =).

from friendly.

aroberge avatar aroberge commented on August 25, 2024

This has been taken care of in the latest version.

from friendly.

JulienPalard avatar JulienPalard commented on August 25, 2024

I'm always amazed how fast you fix my issues, thanks André!

from friendly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.