簡體   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