User Controls

Syntax error while the syntax is actually correct.

  1. #1
    Sophie Pedophile Tech Support
    This 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?
  2. #2
    NARCassist gollums fat coach
    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.



    .
  3. #3
    Sophie Pedophile Tech Support
    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.
  4. #4
    NARCassist gollums fat coach
    so you din't even try it?



    .
  5. #5
    aldra JIDF Controlled Opposition
    enforced whitespace is for homosexuals
  6. #6
    Sophie Pedophile Tech Support
    Originally posted by NARCassist so you din't even try it?



    .



    i know these things fam
    The following users say it would be alright if the author of this post didn't die in a fire!
  7. #7
    NARCassist gollums fat coach
    ok, well i was only trying to help



    .
  8. #8
    Sophie Pedophile Tech Support
    Originally posted by NARCassist ok, well i was only trying to help



    .

    I know and i appreciate it bruv (^_^')
  9. #9
    Sophie Pedophile Tech Support
    Of course the problem is a missing parenthesis half way down through the function... (-_-")
  10. #10
    NARCassist gollums fat coach
    Originally posted by Sophie While i know for a fact all of that is the proper syntax.

    lol



    .
  11. #11
    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.
  12. #12
    Sophie Pedophile Tech Support
    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.
  13. #13
    Sophie Pedophile Tech Support
    Originally posted by NARCassist lol



    .

    Lol all yo want the syntax in the OP was all correct. It was in reference to another function i am writing in a personal project of mine that the parenthesis was missing like halfway through a 100 line function.
  14. #14
    NARCassist gollums fat coach
    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.



    .
  15. #15
    Sophie Pedophile Tech Support
    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.
  16. #16
    Rivotril Houston
    I 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"""
Jump to Top