User Controls
Syntax error while the syntax is actually correct.
-
2018-01-29 at 9:58 AM UTCThis has been a recurring theme in my programming 'career'. And i hate this shit. Take this in example.
#!/usr/bin/env python2.7
import os
def logo():
print 'dank ass ascii logo'
def usage():
os.system("clear")
logo()
print """Here is how to use this program
yada yada
and blah blah
"""
then i get a fucking
File "example.py", line 7
def usage():
^
SyntaxError: invalid syntax
While i know for a fact all of that is the proper syntax. Usually this is an issue of indentation. But with the triple `"` this does not mattter. And just works in general. I have tested this and always it does.
Also i am using the right interpreter and i am making sure the program is run with the right interpreter with the shebang line.
I mean wtf nigga. Even if i double check the indentation of every line in the function and redo it with tabs only or spaces only i still get this shit so what is going on. I am POSITIVE the syntax is correct.
Halp? -
2018-01-29 at 10:06 AM UTCtry it without the colons after you define the logo and usage functions. like:
#!/usr/bin/env python2.7
import os
def logo()
print 'dank ass ascii logo'
def usage()
os.system("clear")
logo()
print """Here is how to use this program
yada yada
and blah blah
"""
i mean it might not work tho, i do python 3, so not really touched on python 2. its too gay for me to go anywhere near it tbh.
. -
2018-01-29 at 10:11 AM UTC
Originally posted by NARCassist try it without the colons after you define the logo and usage functions. like:
#!/usr/bin/env python2.7
import os
def logo()
print 'dank ass ascii logo'
def usage()
os.system("clear")
logo()
print """Here is how to use this program
yada yada
and blah blah
"""
i mean it might not work tho, i do python 3, so not really touched on python 2. its too gay for me to go anywhere near it tbh.
.
Lol fuck off with 2.7 being gay :P
It's better than 3 and in 2 you end a function definition line with a colon. -
2018-01-29 at 10:14 AM UTCso you din't even try it?
. -
2018-01-29 at 10:27 AM UTCenforced whitespace is for homosexuals
-
2018-01-29 at 10:28 AM UTC
-
2018-01-29 at 2:30 PM UTCok, well i was only trying to help
. -
2018-01-29 at 4:48 PM UTC
-
2018-01-29 at 5:44 PM UTCOf course the problem is a missing parenthesis half way down through the function... (-_-")
-
2018-01-29 at 6:03 PM UTC
-
2018-01-29 at 8 PM UTC
Originally posted by Sophie Of course the problem is a missing parenthesis half way down through the function… (-_-")
Where?
Early on I learned that if it didn't make sense it was always my fault, and that I was dumb as shit.
Every time I thought I was right I was wrong. Insane. I blame not being brought along quickly enough in secondary school. -
2018-01-29 at 11:04 PM UTC
Originally posted by Issue313 Where?
Early on I learned that if it didn't make sense it was always my fault, and that I was dumb as shit.
Every time I thought I was right I was wrong. Insane. I blame not being brought along quickly enough in secondary school.
A functio i was actually writing. The OP code is an example, in any case i am always thrown off by the interpreter pointing me in the wrong direction with the error message. So it says i have an issue in a certain function but then it does not specify the offending line properly. -
2018-01-29 at 11:20 PM UTC
-
2018-01-29 at 11:29 PM UTCits the same tho when you can't find something. you go pulling the room apart. you look in every conceivable place and its not there. yet you just had it and there's been no one else in the room. you go through all the draws, all the cupboards, look underneath everything in case it got dropped. even go in other rooms because you've searched everywhere like 3 times. then just as you give up and start believing in fairies, there it is right there on top of the fucking draws. it couldn't be more right in your field of vision at all times, lol. it was certainly in your field of vision when you went through the draws 3 fucking times. life glitches can do your nut right in sometimes.
. -
2018-01-29 at 11:43 PM UTC
Originally posted by NARCassist its the same tho when you can't find something. you go pulling the room apart. you look in every conceivable place and its not there. yet you just had it and there's been no one else in the room. you go through all the draws, all the cupboards, look underneath everything in case it got dropped. even go in other rooms because you've searched everywhere like 3 times. then just as you give up and start believing in fairies, there it is right there on top of the fucking draws. it couldn't be more right in your field of vision at all times, lol. it was certainly in your field of vision when you went through the draws 3 fucking times. life glitches can do your nut right in sometimes.
.
Yeah lol. In any case, now that that has been sorted i have a brand new set of bugs i get to crack my skull on trying to fix. And these aren't simple cases of missing parenthesis. It's all good though, once i have this sorted out i will have learned a shitload again and that in and of itself is a reward in it's own right. The fully functional program at the end of the tunnel will just be the icing on the cake. -
2018-02-01 at 9:39 PM UTCI tried to run your code here but it appears that the error is in identation:
import os
def logo():
print "dank ass ascii logo"
def usage():
os.system("clear")
logo()
print """Here is how to use this program
yada yada
and blah blah"""