简体   繁体   中英

Python program gives internal error: _select is undefined

    #!/usr/bin/python

#Start creating a "pseudo-shell"... to give the users a good feeling.
print "Starting..."
import random #For generator
import time #For timer functions



#Always good to have whitespace

#Declare variables
gen_out = 0 #For generator output
user_num = 0 #Declare variable before input! It goes faster.
gen_floor = 0 #For declaring minimum... once again a prompt.
gen_ceiling = 0 #For maximum... another prompt.
time.sleep(4.75)#Make the pseudo-shell more lifelike.
print "Creating computer profile in memory...\nPlease wait."#More pseudo-shells...
time.sleep(12.9384587)#Here, we start the slowdown notification.
print "Done.\nI noticed your computer setup has not been approved to be fast. You may experience slowdowns in this program."#Make sure they think you made a bulky program... it'll come in handy with delays.
time.sleep(1.5493476)#Delay before integrity check
rnd_seed = ( random.randint(1,1000) * random.randint(1,1000) + 2463) #Integrity check... so we know they are not manipulating RAM.
rnd_seed_bak = rnd_seed #This makes 2 variables, one for generating, one for integrity check.
print rnd_seed + "\nPlease write down this number. You may need it if your PC hangs. You have 10 seconds to write it down."#Security check. Make 'em write!
time.sleep(10)#Stay true to your word.
print "Decompressing Linux."
time.sleep(4.8765)#Make them think they are booting a virtual machine. They'll have a reason to wait.
print "OK, booting the kernel.\n"
print "WARNING! Processes out of sync! Attempting fix...\n"#They need a stir...
time.sleep(2.98665)
print "OK, fixed!\n"
print "Initializing network daemon...   "#Make it real!!!
time.sleep(0.957531345543)
print "   [OK]\n"
print "Initializing Xorg shell...             [FAILED]\n"
print "WARNING!!!!! Xorg query came up as missing! Xorg not installed! When done, dropping to shell!\n"
time.sleep(0.567424567)
print "Boot taking too long! HURRY UP!\n"
print "CANNOT FIND \"VM VirtualBox HDD 1.vmdk\"!!! BACKUPS LOST!\n"
print "Continuing boot in silence mode...\n"
time.sleep(17.94627495638)
print "Done! Dropping to shell...\n\n\n"
time.sleep (0.9284657387)
print "Welcome to GenUx!\n\n\n"
print "Final touches being added...\n"
print "Boot complete! Sorry it took so long!\n"
print "How many numbers would you like generated...?\n"
user_num = hex(int(input("Input in Decimal:")))
gen_ceiling = hex(int(input("What is the ceiling in decimal?")))
gen_floor = hex(int(input("What is the floor in decimal?")))

Why does this give me "Internal Error: _select is undefined"? I have never had that error before... it confuses me! I have tried 3 different sites, several python versions... I can't find out why it does this!

The only problem in your code is trying to concat an int to a string:

 rnd_seed + "\nPlease write down this number. You may need it if your PC hangs. You have 10 seconds to write it down.")  # Security check. Make 'em write!

You need to cast as a string:

str(rnd_seed) + ...

You should also be using raw_input not input for python2:

 gen_ceiling = hex(int(raw_input("What is the ceiling in decimal?")))

In python you don't have to declare variables so you can remove:

gen_out = 0 #For generator output
user_num = 0 #Declare variable before input! It goes faster.
gen_floor = 0 #For declaring minimum... once again a prompt.

and just assign the variables to the output from hex(int(raw_input...

The error is a known bug with repl, a far as your system python goes it must have somehow gotten compiled for a different platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM