Comments (3)
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:
- 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.
- Keep an eye out for any questions on Reddit, StackOverflow, etc., that I come accross with similar errors.
- 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.
This has been taken care of in the latest version.
from friendly.
I'm always amazed how fast you fix my issues, thanks André!
from friendly.
Related Issues (20)
- Using new information for SyntaxError for Python 3.10 HOT 2
- Using with the logging module. HOT 3
- NameError on missing stdlib imports HOT 2
- Internet connection lost, or server unreachable HOT 6
- Use SITE_PACKAGES to short paths
- MemoryError HOT 5
- tox won't pass HOT 14
- TypeError: dict.update() argument after ** must be a mapping, not tuple HOT 2
- formatting placeholder issue in attribute_error.py HOT 2
- AssertionError HOT 3
- TypeError measuring uncalled function HOT 1
- ValueError: month must be in 1..12 HOT 4
- Improved location information
- Introduce Friendly.help() HOT 1
- Remove more()
- ValueError: invalid literal for int() with base 10: '' HOT 7
- Future work: more complete search of "bad lines" HOT 1
- Make rich optional HOT 7
- TypeError cases from bugs.python.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from friendly.