[SOLVED] OverflowError: value too large to convert to short

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
krt_org
Newbie
Posts: 14
Joined: Wed Jul 04, 2018 7:48 pm
Contact:

[SOLVED] OverflowError: value too large to convert to short

#1 Post by krt_org »

Hello. When I try to run my VN I get the following error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

After loading the script.
OverflowError: value too large to convert to short

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

Full traceback:
  File "renpy/bootstrap.py", line 326, in bootstrap
    renpy.main.main()
  File "renpy/main.py", line 505, in main
    if renpy.parser.report_parse_errors():
  File "renpy/parser.py", line 3006, in report_parse_errors
    renpy.display.error.report_parse_errors(full_text, error_fn)
  File "renpy/display/error.py", line 194, in report_parse_errors
    error_fn=error_fn,
  File "renpy/game.py", line 284, in invoke_in_new_context
    return callable(*args, **kwargs)
  File "renpy/display/error.py", line 46, in call_exception_screen
    return renpy.ui.interact(mouse="screen", type="screen", suppress_overlay=True, suppress_underlay=True)
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3276, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3792, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "renpy/display/core.py", line 2521, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 492, in renpy.display.render.render_screen
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 786, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 786, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 786, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/screen.py", line 681, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 786, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 1193, in render
    st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 1683, in render
    cwidth, cheight = sizeit('c', width, height, 0, 0)
  File "renpy/display/layout.py", line 1680, in sizeit
    rend = renpy.display.render.render_for_size(pos_d[pos], width, height, st, at)
  File "render.pyx", line 315, in renpy.display.render.render_for_size
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 1683, in render
    cwidth, cheight = sizeit('c', width, height, 0, 0)
  File "renpy/display/layout.py", line 1680, in sizeit
    rend = renpy.display.render.render_for_size(pos_d[pos], width, height, st, at)
  File "render.pyx", line 315, in renpy.display.render.render_for_size
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/viewport.py", line 265, in render
    surf = renpy.display.render.render(self.child, child_width, child_height, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 989, in render
    surf = render(d, width - x, rh, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/text/text.py", line 2062, in render
    layout = Layout(self, width, height, renders, splits_from=virtual_layout)
  File "renpy/text/text.py", line 762, in __init__
    textsupport.tweak_glyph_spacing(all_glyphs, lines, target_x_delta, target_y_delta, maxx, y) # @UndefinedVariable
  File "textsupport.pyx", line 969, in renpy.text.textsupport.tweak_glyph_spacing
  File "textsupport.pxd", line 79, in renpy.text.textsupport.Line.y.__set__
OverflowError: value too large to convert to short
I read other threads reporting this same problem, but I don't think I understand enough of the troubleshooting process to figure out where my problem is.
For background about my project, my script.rpy has ~1500 lines that are split into 3 chapters. It's a dating sim, so I have 12 other .rpy files that hold the code for each of the characters. Right now, the script.rpy file is totally self-contained, it doesn't jump to any of the other files.

So now my question is: when I go to run the project, it should only run the script that is in script.rpy since I don't have it jump to any of the other files, right? So that would mean the error is in script.rpy? I tried to cut out different parts of the script to see if I could find the error and couldn't find anything. I added a "return" right after the first line of dialogue and it still caused the error. Putting a return there would cause it to only run the code before the return, right?

I've made a few projects using RenPy, so I have a good estimate for about how much text can fit in the textbox. My longest line is 186 characters, so I'm at a loss for finding a line that I didn't parse right. I know I have some spacing issues in the other files, but RenPy wouldn't be looking at those files because I didn't jump to any of them, would it?

I'm hoping someone can help explain more about how to troubleshoot this. I tried the suggested code to add to RenPy's text file in this thread viewtopic.php?t=50402 , but that didn't bare any results.

I hope I gave enough information to have my question make sense. I appreciate any advice anyone can give me!
Last edited by krt_org on Mon Jun 21, 2021 2:43 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Help: OverflowError: value too large to convert to short

#2 Post by Alex »

So now my question is: when I go to run the project, it should only run the script that is in script.rpy since I don't have it jump to any of the other files, right?
Wrong.

Putting a return there would cause it to only run the code before the return, right?
Wrong...

I know I have some spacing issues in the other files, but RenPy wouldn't be looking at those files because I didn't jump to any of them, would it?
It surely will looking those files.


For the test purposes:
- remove all the rpy-files that contains game texts from 'game' folder and subfolders (leave only script.rpy),
- delete all rpyc-files (not rpy),
- check if game runs,
- add rpy-files with game texts one by one to find the one that causes issue,
- check the script in this file (color highlighting).

Ren'Py uses two kinds of quotes " and '. To use quotes inside a text they must be different from quotes used at the start and the end of text or be escaped using \-character. If one of quotes is misplaced the huge part of your script will be interpreted as a text (usually it highlights green) - that's might be the issue.

User avatar
krt_org
Newbie
Posts: 14
Joined: Wed Jul 04, 2018 7:48 pm
Contact:

Re: Help: OverflowError: value too large to convert to short

#3 Post by krt_org »

Thank you so much, Alex, for explaining my misunderstanding on how running a program works. That really helped a lot! It's a lot easier to work out, knowing how to do it!!

So I was able to get script.rpy running just fine when I took out the other files. I put each of the files in by their own (so I would have script.rpy and then only one other extra file at one time) and they came out with normal errors. I guess you can't use label names that start with numbers in RenPy...? Each of my labels use a naming convention that have a number at the start of the name. With that issue and atrocious indentation errors, each file has many parsing errors. I have a lot of work ahead of me in terms of getting all those errors squared away.

I found one place where I forgot to use a backslash for in-text double quotes, so that could have attributed to the error.

When I have all of the files back together in their original folder with script.rpy, I still get the same overflow error. My guess is that it could be just because I have so many different errors, it'd be too much to display each of them? I can get 10 out of the 12 files into the right folder with no overflow error, but when I put an 11th one in, it gives the error. No matter what order I do things in.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Help: OverflowError: value too large to convert to short

#4 Post by Ocelot »

krt_org wrote: Sun Jun 20, 2021 8:44 pm I guess you can't use label names that start with numbers in RenPy...? Each of my labels use a naming convention that have a number at the start of the name. With that issue and atrocious indentation errors, each file has many parsing errors. I have a lot of work ahead of me in terms of getting all those errors squared away.
It is in documentation.
https://www.renpy.org/doc/html/language ... statements
Name
A name begins with a letter or underscore, which is followed by zero or more letters, numbers, and underscores. For our purpose, Unicode characters between U+00a0 and U+fffd are considered to be letters.
And "can start only with a letter" is an almost universal rule about variable names in programming.
krt_org wrote: Sun Jun 20, 2021 8:44 pm When I have all of the files back together in their original folder with script.rpy, I still get the same overflow error. My guess is that it could be just because I have so many different errors, it'd be too much to display each of them? I can get 10 out of the 12 files into the right folder with no overflow error, but when I put an 11th one in, it gives the error. No matter what order I do things in.
Parsing error means that parser couldn't make head or tails of your code. It got off tracks and it is hard to predict how it would parse following lines. One error might cause next one and so on. You should fix all known problems first, otherwise you might work on problem which only happens as a consequence of previous errors.
< < insert Rick Cook quote here > >

User avatar
krt_org
Newbie
Posts: 14
Joined: Wed Jul 04, 2018 7:48 pm
Contact:

Re: [SOLVED] OverflowError: value too large to convert to short

#5 Post by krt_org »

Thank you, Ocelot! It makes sense you can't start with a number; I just hadn't thought about it.

After editing out the errors for a couple of files, the overflow error went away. So in the end, I just had too many parsing errors. My problem is fixed now!

Post Reply

Who is online

Users browsing this forum: Google [Bot]