Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid syntax on an empty line [closed]

Tags:

python

For some reason, I'm getting an error:

File "prode.py", line 50

                                                                                                        ^
SyntaxError: invalid syntax

This is what my code looks like:

def start():
#Is the user trying to get pixel or percentage data,
if (len(sys.argv)) == 4:
    if (sys.argv[1]) == "-px":
        pct = float(sys.argv[2])
        pxl = float(sys.argv[3])
        divByCent = pct*pxl
        ans = divByCent/100
        print "%f pct of %f px = %f px" % (pct, pxl, ans)
    elif (sys.argv[1]) == "-pe":
        pxlOne = float(sys.argv[2])
        pxlTwo = float(sys.argv[3])
        divByTwo = pxlOne * 100
        ans = divByTwo / 1280
        print "%f pxl of %f pxl = %f pct" % (pxlOne, pxlTwo, ans)
#Or something based on a ratio?
elif (len(sys.argv) == 3):
    if (sys.argv[1] == "-use"): ratioCalc = Ratio(float(sys.argv[2]), float(sys.argv[3])

    #Line 50

Does anybody know where this is coming from?

like image 782
blockaj Avatar asked Dec 20 '22 13:12

blockaj


1 Answers

You've missed last parenthesis:

if (sys.argv[1] == "-use"): ratioCalc = Ratio(float(sys.argv[2]), float(sys.argv[3]))

like image 133
Necronomicron Avatar answered Jan 01 '23 21:01

Necronomicron