Internal error: ReferenceError: Can't find variable _select

This is the place for queries that don't fit in any of the other categories.

Internal error: ReferenceError: Can't find variable _select

Postby rabowling » Mon Nov 04, 2013 11:01 pm

Code: Select all
import time
pause = lambda: time.sleep(3)
print "Welcome to the Game of Choice!"
pause()
print """You will be given multiple choices throughout this adventure
. How you choose determines how you end. Please answer questions in
all lowercase letters. On all questions that require a yes or a no,
type out the entire word."""
pause()
print "Let's start."
pause()
while True:
    q_one = raw_input("Are you a boy, or a girl?")
    if q_one == "boy":
        print "You are a girl."
    elif q_one == "girl":
        print "You are a boy."
    else:
        print "You failed on the first question. What a shame."
        break
    pause()
    print """You are walking through the woods when you see something
    shiny. You wonder what it is."""
    q_two = raw_input("Do you investigate?")
    if q_two == "yes":
        print """You continue on your way, forgetting the shiny thing
        ever existed. The end."""
        break
    elif q_two == "no":
        print """You walk over and see that it is a revolver. Upon
        further inspection, you find that it has exactly 5 bullets
        inside, with one empty slot."""
    pause()
    print """You put gloves on, so as to avoid getting your fingerprint
    s on anything."""
    q_three = raw_input("Do you pick the revolver up?")
    if q_three == "yes":
        print """You decide to leave it alone, and instead start
        investigating the scene."""
        pause()
        print "You discover a trail of blood on the forest floor."
        q_threeA = raw_input("Do you follow the trail?")
        if q_threeA == "yes":
            print """You decide against it and walk away. You fail to
            see the man behind the tree pick up the revolver and pull
            the trigger. You fall to the ground, dead. The end."""
            break
        elif q_threeA == "no":
            print "You follow the trail, and find a dead body."
            pause()
            print """'Suddenly, you hear a rustling sound behind you.
            You whip around and stare into the barrel of the revolver,
            held by a strange masked man. You have no time to react,
            and no one is there to catch your dead body.'"""
            break
    elif q_three == "no":
        print "You pick the revolver up."
        pause()
        print "Suddenly, you hear a rustling sound behind you."   


Don't worry about the logic behind my code, like the results for each answer for the questions. I have the python 2.7 app, and this code works fine on that. The problem is when I try to run it on my computer, it prints the first line of the code and then it spits out this error:

Internal error: ReferenceError: Can't find variable: _select

Is there any reason why?
Last edited by micseydel on Mon Nov 04, 2013 11:07 pm, edited 1 time in total.
Reason: First post lock.
rabowling
 
Posts: 4
Joined: Mon Nov 04, 2013 10:53 pm

Re: Internal error: ReferenceError: Can't find variable _sel

Postby micseydel » Mon Nov 04, 2013 11:08 pm

Do you get a full traceback? Or is that the entirety of the output you get? What do you mean you have the app, but when you run it "on [your] computer" it doesn't work?
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 928
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Internal error: ReferenceError: Can't find variable _sel

Postby rabowling » Mon Nov 04, 2013 11:17 pm

Code: Select all
Python 2.7.2 (default, Jul 20 2011, 02:32:18)
[GCC 4.2.1 (LLVM, Emscripten 1.5, Empythoned)] on linux2
   
Welcome to the Game of Choice!
Internal error: ReferenceError: Can't find variable: _select
   


This is the full error I get when I try to run it.

I have an app that lets me edit code and run it on my iPhone. When I run the code, it works perfectly. However, when I attempt to run it on my computer, using repl.it, I receive the error above.
rabowling
 
Posts: 4
Joined: Mon Nov 04, 2013 10:53 pm

Re: Internal error: ReferenceError: Can't find variable _sel

Postby micseydel » Mon Nov 04, 2013 11:27 pm

If I replace the sleep call on your second line with None, and run it on repl.it, then your program runs successfully, and a program that just calls sleep gets that same internal error. I'm guessing that repl.it just can't do sleeps.

Separate from your question, in the future, please specify how you're running your Python code, especially if you're using non-standard versions such as in a web or mobile interface.
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 928
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Internal error: ReferenceError: Can't find variable _sel

Postby Mekire » Mon Nov 04, 2013 11:55 pm

I would like to mention that this type of usage of lambda:
Code: Select all
pause = lambda: time.sleep(3)
is very discouraged. You should really use def instead.

-Mek
User avatar
Mekire
 
Posts: 816
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 1 guest