Why I get exception?

3 views
Skip to first unread message

נתי שטרן

unread,
Nov 24, 2020, 9:58:03 AM11/24/20
to desertpy
 File "C:\Users\Administrator\Desktop\files.py", line 58
    if boola:
    ^
IndentationError: unexpected indent

code:


for line in openfile:
            ln=ln+1
            quo=urllib.parse.quote(quer2y)
            boola=line.__contains__(quo)
            
                if boola:
                    with db_session:
                        l=Line(text=line,number=ln)
                        r=Result(filePath=addr,line=l)
                        s=Search(myID=TIMER,query=quo,results=r)
                        commit()
    a=""

Austin Godber

unread,
Nov 24, 2020, 10:15:58 AM11/24/20
to dese...@googlegroups.com
Hi

I think you need to use a code editor with a built in linter for python.  The reason is because your if is indented from the line above it.  That's what "unexpected indent" means.

Use Atom or VSCode or something that can point out your simple errors.

And sharing code in email like this can mess up your indentation.  I recommend you use gist.github.com or some other online code pasting service, otherwise copying and pasting between your editor and mess things up.

Austin

--
You received this message because you are subscribed to the Google Groups "desertpy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to desertpy+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/desertpy/a10f3827-db75-4c10-b5bb-424095119366n%40googlegroups.com.

נתי שטרן

unread,
Nov 24, 2020, 10:20:06 AM11/24/20
to desertpy
I need to open this file in vs?

ב-יום שלישי, 24 בנובמבר 2020 בשעה 17:15:58 UTC+2, godber כתב/ה:

Austin Godber

unread,
Nov 24, 2020, 10:51:05 AM11/24/20
to dese...@googlegroups.com
vscode is a lighter weight code editor, not VS itself


Reply all
Reply to author
Forward
0 new messages