Problem running examples

Help
Mr.SpOOn
2008-07-09
2013-05-17
  • Mr.SpOOn

    Mr.SpOOn - 2008-07-09

    Hi,
    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/example_fc.py
    writing ./compiled_krb/example_bc.py
    writing ./compiled_krb/example_plans.py
    writing ./compiled_krb/fc_example_fc.py
    writing ./compiled_krb/bc2_example_bc.py
    writing ./compiled_krb/bc_example_bc.py
    >>> test.fc_test([person1='bruce'])
      File "<stdin>", line 1
        test.fc_test([person1='bruce'])
                             ^
    SyntaxError: invalid syntax

    What is the problem?

    Thanks,
    Carlo

     
    • 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')

      or

      >>> 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.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks