Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

IndentationError -- #32

Closed
anupkalburgi opened this issue Apr 27, 2013 · 8 comments
Closed

IndentationError -- #32

anupkalburgi opened this issue Apr 27, 2013 · 8 comments

Comments

@anupkalburgi
Copy link

While we run pep257.check_files(files). ( API)

It is right to detect indentation problem. But then it should not be stopping the execution. How about we handle this exception and report it in the output ? or its intentionally left like that ?
Or am i missing some config ?

File "/Users/anupkalburgi/active/active/lib/python2.7/site-packages/pep257.py", line 197, in parse_top_level
kind, value, (line, char), _, _ = next(token_gen)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py", line 351, in generate_tokens
("", lnum, pos, line))
File "", line 9
except:

@keleshev
Copy link
Contributor

That means that syntax of your file is incorrect. pep257 is using Python tokenize module, which raises this error.

@anupkalburgi
Copy link
Author

Thanks for the reply,

That is right. I a have issue with my file which is been checked. But that should be reported as a error instead of halting my execution. In a way other things are reported.

@keleshev
Copy link
Contributor

I'm not sure it should report that, pep257 checks docstrings, not Python syntax.

@anupkalburgi
Copy link
Author

I think it should not be halting the execution for python syntax errors, instead raise a exception or silently pass (Which is bad again) . I am looking at how to get around, will post back.

Thanks

@dpursehouse
Copy link
Contributor

This might be fixed by 3dba783

@JensRantil
Copy link
Contributor

This might be fixed by 3dba783.

@anupkalburgi Would it be possible for you to verify whether 3dba783 fixes your issue?

@adiroiban
Copy link

I think that in a real world most users will first check the code with pyflakes and pep8 and only if those pass will also try pep257... if the python file is not valid.. tough titty.. use proper tool for that.

@Nurdok
Copy link
Member

Nurdok commented Nov 8, 2014

This issue is quite old and in any case I don't think a docstring checker has any business going over invalid Python files. I'm closing this issue. If this pops up again, feel free to open a new one.

@Nurdok Nurdok closed this as completed Nov 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants