Problem running examples

  • Mr.SpOOn

    Mr.SpOOn - 2008-07-09

    I've just installed pyke using easy_install, with python 2.5.

    I've downloaded the archive with the examples. When I open the Python shell and try to run the family_relations example, I get this:

    >>> import test
    writing ./compiled_krb/
    writing ./compiled_krb/
    writing ./compiled_krb/
    writing ./compiled_krb/
    writing ./compiled_krb/
    writing ./compiled_krb/
    >>> test.fc_test([person1='bruce'])
      File "<stdin>", line 1
    SyntaxError: invalid syntax

    What is the problem?


    • Bruce Frederiksen

      The square brackets in the call to test.fc_test were meant to mean that the parameter is optional.  So either of the following calls would be legal:

      >>> test.fc_test(person1='bruce')


      >>> test.fc_test()

      It also means that the person1 parameter defaults to 'bruce' if you omit it.  So the above two calls would act identically.

      Since the function only has one default parameter, you can also omit the parameter name without any confusion:

      >>> test.fc_test('bruce')

      Hope this helps!

    • Mr.SpOOn

      Mr.SpOOn - 2008-07-10

      Ok, sorry, my fault :D
      It works.

      It's just that seeing the Python prompt sumbol '>>>' I thought that was a command to copy and execute as it was. So, then, I looked for the error somewhere else.

      Anyway, thanks.


Log in to post a comment.