当运行我的程序时,我收到一条消息,上面写着;Python REPL进程已退出;这是否正常?
我正在运行下面所附的程序,每当我在Microsoft Visual Studio Ultimate 2013中运行它时,我都会收到以下消息:Python REPL进程已退出。一般来说,我对python和编程非常陌生。程序按预期运行,但这条消息让我担心。这是否正常?如果这不正常,请告诉我如何修复。我使用本机pythonidle运行它,没有收到任何错误,但仍然怀疑这是否会导致以后出现问题。我只是想知道如果我扩展这段代码,VisualStudio是否会试图警告我可能发生的事情。命令行只提供程序的输出当运行我的程序时,我收到一条消息,上面写着;Python REPL进程已退出;这是否正常?,python,visual-studio,python-3.x,visual-studio-2015,python-imaging-library,Python,Visual Studio,Python 3.x,Visual Studio 2015,Python Imaging Library,我正在运行下面所附的程序,每当我在Microsoft Visual Studio Ultimate 2013中运行它时,我都会收到以下消息:Python REPL进程已退出。一般来说,我对python和编程非常陌生。程序按预期运行,但这条消息让我担心。这是否正常?如果这不正常,请告诉我如何修复。我使用本机pythonidle运行它,没有收到任何错误,但仍然怀疑这是否会导致以后出现问题。我只是想知道如果我扩展这段代码,VisualStudio是否会试图警告我可能发生的事情。命令行只提供程序的输出
from PIL import Image
class PixelCounter(object):
''' loop through each pixel and average rgb '''
def __init__(self, imageName):
self.pic = Image.open(imageName)
#Opens image
self.imgData = self.pic.load()
# load image data
def averagePixels(self):
r, g, b = 0, 0, 0
count = 0
# Declares variables and sets them to 0 to be modified later
for x in range(self.pic.size[0]):
for y in range(self.pic.size[1]):
tempr,tempg,tempb = self.imgData[x,y]
r += tempr
g += tempg
b += tempb
count += 1
# Adds the rgb values of each pixel to the total r, g, b values
ravg = r/count
gavg = g/count
bavg = b/count
# calculates averages
round(ravg)
round(gavg)
round(bavg)
# Rounds numbers
# print("R: ", ravg, ", G: ", gavg, ", B: ", bavg,", Total Pixels: ", count)
# return (r/count), (g/count), (b/count), count
if __name__ == '__main__':
# assumes you have a test.jpg in the working directory!
pc = PixelCounter("test.jpg")
#print ("red, green, blue, total_pixel_count")
print("R: ", ravg, ", G: ", gavg, ", B: ", bavg,", Total Pixels: ", count)
#pc.averagePixels()
试着从命令行运行它,看看它会出现什么错误(可能不会出现任何错误)。我使用本机python idle运行它,没有收到任何错误,但仍然怀疑这是否会导致以后出现问题。我只是想知道如果我扩展这段代码,VisualStudio是否会试图警告我可能发生的事情。命令行只提供程序的输出。