繁体   English   中英

Python程序给出了内部错误:_select未定义

[英]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?")))

为什么这会给我“内部错误:_select未定义”? 我以前从来没有犯过这个错误......它让我感到困惑! 我尝试了3个不同的网站,几个python版本......我无法找到它为什么这样做!

代码中唯一的问题是尝试将int连接到字符串:

 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!

你需要强制转换为字符串:

str(rnd_seed) + ...

您还应该使用raw_input而不是python2的input

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

在python中,您不必声明变量,因此您可以删除:

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.

并将变量分配给hex(int(raw_input...的输出hex(int(raw_input...

这个错误是repl的一个已知错误 ,就你的系统python而言,它必须以某种方式为不同的平台编译。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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