Getting a traceback/error message

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Chidori-cha
Newbie
Posts: 15
Joined: Wed Jun 23, 2010 2:14 am
Projects: Lied
Contact:

Getting a traceback/error message

#1 Post by Chidori-cha » Tue Jul 20, 2010 4:55 pm

Well, after doing some linting after working on my project, I'm getting back a traceback/error message that goes as followed:

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

SyntaxError: non-keyword arg after keyword arg

While compiling python block starting at line 10 of C:\Users\Ruka\Projects\Visual Novel\Kioku ~The Afterlife~/game/options.rpy.

-- Full Traceback ------------------------------------------------------------

  File "G:\Visual Novel\renpy-6.10.2\renpy\bootstrap.py", line 260, in bootstrap
  File "G:\Visual Novel\renpy-6.10.2\renpy\main.py", line 173, in main
  File "G:\Visual Novel\renpy-6.10.2\renpy\script.py", line 480, in load_script
  File "G:\Visual Novel\renpy-6.10.2\renpy\script.py", line 160, in __init__
  File "G:\Visual Novel\renpy-6.10.2\renpy\script.py", line 373, in load_appropriate_file
  File "G:\Visual Novel\renpy-6.10.2\renpy\script.py", line 340, in load_file
  File "G:\Visual Novel\renpy-6.10.2\renpy\script.py", line 429, in update_bytecode
  File "G:\Visual Novel\renpy-6.10.2\renpy\python.py", line 254, in py_compile_exec_bytecode
  File "G:\Visual Novel\renpy-6.10.2\renpy\python.py", line 229, in py_compile
  File "compiler\transformer.pyo", line 52, in parse
  File "compiler\transformer.pyo", line 129, in parsesuite
  File "compiler\transformer.pyo", line 125, in transform
  File "compiler\transformer.pyo", line 158, in compile_node
  File "compiler\transformer.pyo", line 189, in file_input
  File "compiler\transformer.pyo", line 1080, in com_append_stmt
  File "compiler\transformer.pyo", line 306, in stmt
  File "compiler\transformer.pyo", line 1073, in com_stmt
  File "compiler\transformer.pyo", line 316, in simple_stmt
  File "compiler\transformer.pyo", line 1080, in com_append_stmt
  File "compiler\transformer.pyo", line 306, in stmt
  File "compiler\transformer.pyo", line 1073, in com_stmt
  File "compiler\transformer.pyo", line 354, in expr_stmt
  File "compiler\transformer.pyo", line 567, in testlist
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 583, in test
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 597, in or_test
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 602, in and_test
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 606, in not_test
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 613, in comparison
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 646, in expr
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 650, in xor_expr
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 654, in and_expr
  File "compiler\transformer.pyo", line 1065, in com_binary
  File "compiler\transformer.pyo", line 658, in shift_expr
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 670, in arith_expr
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 682, in term
  File "compiler\transformer.pyo", line 792, in com_node
  File "compiler\transformer.pyo", line 702, in factor
  File "compiler\transformer.pyo", line 721, in power
  File "compiler\transformer.pyo", line 1196, in com_apply_trailer
  File "compiler\transformer.pyo", line 1219, in com_call_function
  File "compiler\transformer.pyo", line 1258, in com_argument
SyntaxError: non-keyword arg after keyword arg

While compiling python block starting at line 10 of C:\Users\Ruka\Projects\Visual Novel\Kioku ~The Afterlife~/game/options.rpy.

Ren'Py Version: Ren'Py 6.10.2e
In my options script, however, beginning at line 10, the beginning segment looks as followed:

Code: Select all

init -1 python hide:

    ## Should we enable the use of developer tools? This should be
    ## set to False before the game is released, so the user can't
    ## cheat using developer tools.

    config.developer = True

    ## These control the width and height of the screen.

    config.screen_width = 800
    config.screen_height = 600

    ## This controls the title of the window, when Ren'Py is
    ## running in a window.

    config.window_title = u"Kioku" 
...And I compared the options script I had, to the template's option script. It looks just the same, except for the custom-menu backgrounds. I don't know much about Python scripting, compared to the Ren'py language, so if it could be a problem with the Python scripting, then I'm not sure how to fix that.

Sorry if I sound a bit clueless on this all, and if a problem similar to this has been asked/solved before, but...help would be much appreciated, please, and thank you.

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Getting a traceback/error message

#2 Post by Jake » Tue Jul 20, 2010 5:25 pm

Chidori-cha wrote:

Code: Select all

SyntaxError: non-keyword arg after keyword arg

While compiling python block starting at line 10 of C:\Users\Ruka\Projects\Visual Novel\Kioku ~The Afterlife~/game/options.rpy.
...And I compared the options script I had, to the template's option script. It looks just the same, except for the custom-menu backgrounds. I don't know much about Python scripting, compared to the Ren'py language, so if it could be a problem with the Python scripting, then I'm not sure how to fix that.
The line number isn't particularly helpful, it's just saying that somewhere in the giant Python block that starts on line 10, there's a syntax error. If you've only modified a couple of lines in that file, then it's likely those lines which have a problem.

The issue is that there's two kinds of parameters to a method in Python. A method looks something like this:

Code: Select all

method(argument, argument, keyword=argument)
- with a name, and then a set of arguments in brackets. These arguments - 'args' - can either be with or without a name (such as 'keyword' above). So in the above example, the first two are "non-keyword args", because they don't have a name and an '=' before them, and the last one is a "keyword arg", because it has a name - "keyword" - before it.

Each method expects a certain specific set of parameters. Some methods expect exactly three parameters, some methods expect one, or none. When a method accepts keyword parameters, then you can specify as many or as few of those keywords as you like. So, for example, the renpy.pause method accepts the following:

Code: Select all

   renpy.pause(delay=None, music=None)
So you call it without any non-keyword args, and you can choose to include one or both or neither of the keyword args "delay" and "music"*.

The keyword args can go in any order, the following two lines of code do the same thing:

Code: Select all

  renpy.pause(delay=10, music=120)
  renpy.pause(music=120, delay=10)
However, if you don't specify the names, it will assume the arguments are specified in the same order as in the manual, so the following lines are the same:

Code: Select all

  renpy.pause(delay=10, music=120)
  renpy.pause(10, 120)
So, if you try something like this:

Code: Select all

  renpy.pause(5, delay=10)
Then Ren'Py will give you an error, saying you specified the 'delay' parameter twice - because it presumes the first parameter is for 'delay' because it's the first parameter defined for that method, but you then specified 'delay' separately.



Now, the drawback with this approach is that if you're going to specify keyword arguments, they have to all come after all of your non-keyword args. This is because otherwise, Ren'Py would never work out which parameters you're meaning to fill out, and you might be obliged to fill out some keyword args you don't want to. Say a method accepts the following arguments:

Code: Select all

  method(a, keyword=value, b)
- if you wanted to pass argument b, then you'd have to also pass 'keyword', because otherwise Ren'Py would just assume that the second parameter was 'keyword' anyway, because it's second in the list. To avoid this kind of problem (and since the whole point of keyword arguments is that you don't have to specify them), you have to place all of your keyword args after all of your non-keyword args.



So, long story short - go through the new lines you've added to your file, and check for any places where you're passing keyword args to a method, and make sure that all the keyword args are at the end of the list of arguments to that method.








* Actually, there's a third, hidden one called "hard", but we'll ignore that for now.
Server error: user 'Jake' not found

User avatar
Chidori-cha
Newbie
Posts: 15
Joined: Wed Jun 23, 2010 2:14 am
Projects: Lied
Contact:

Re: Getting a traceback/error message

#3 Post by Chidori-cha » Tue Jul 20, 2010 6:24 pm

Well, as I mentioned before, the only changes I've made to the options was just the custom-menus. I've changed that back to a color, but I'm still getting the same error message. As for the arguements, I've never set any at all, or made any methods in the scripting.

I forgot to mention this (And I deeply apologize, as this may have prevented you from taking so much time from writing your post), but my only editing was to the storyline alone. My editing to the option scripts didn't have a problem when I first linted them, and I even tested it, which it gave me no problem.

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Getting a traceback/error message

#4 Post by Jake » Tue Jul 20, 2010 6:38 pm

Chidori-cha wrote:Well, as I mentioned before, the only changes I've made to the options was just the custom-menus. I've changed that back to a color, but I'm still getting the same error message. As for the arguements, I've never set any at all, or made any methods in the scripting.
You're definitely not calling any layout.something methods, or anything like that?

If you're really at a loss, then try copying your options.rpy to a file with a different extension (options.old or something) so Ren'Py doesn't pick it up, deleting options.rpyc, and copying a new copy of options.rpy from a new project into your existing project, and try running it again.

If that runs without error, then re-introduce the changes you made to options.rpy one at a time, checking it all runs each time, until you find the one that causes the error.

If it doesn't run without error after you've removed options.rpy, then do the same thing with script.rpy as well, and/or backup and remove any other .rpy files in your project.
Server error: user 'Jake' not found

IceD
Veteran
Posts: 433
Joined: Sun Feb 01, 2009 6:15 pm
Contact:

Re: Getting a traceback/error message

#5 Post by IceD » Tue Jul 20, 2010 6:45 pm

What program do you use to edit the files and how? This might be another problem with file format coding. The script files should be formatted in ANSI, utf-8 is not supported as far as I can remember, and when you use it it gives up various errors, because Ren'Py can't decode script files.

You might try to open files manually with notepad, and be sure to save them with ANSI coding. I don't know if this is the issue, but you can always try. I had similiar problems back in the past and it worked for me.

User avatar
Chidori-cha
Newbie
Posts: 15
Joined: Wed Jun 23, 2010 2:14 am
Projects: Lied
Contact:

Re: Getting a traceback/error message

#6 Post by Chidori-cha » Tue Jul 20, 2010 7:50 pm

It seemed that using another options script worked well. I'll take your advice, and reintroduce the changes. Thank you very much, for your help! I appreciate it. ^ ^

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot