1

在一段时间后运行我的代码时,PyScripter 打开另一段代码并给出错误消息“EOFError:流已关闭”。

这是代码:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import math
from itertools import product, combinations
from numpy import *
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_aspect("equal")

ra_day = loadtxt("RA Days.txt")  
ra_minute = loadtxt("RA Minutes.txt")
ra_second = loadtxt("RA Seconds.txt")
ra = ra_day + (ra_minute/60) + (ra_second/3600)

dec_day = loadtxt("DEC Days.txt") 
dec_minute = loadtxt("DEC Minutes.txt")
dec_second = loadtxt("DEC Seconds.txt")
dec = dec_day + (dec_minute/60) + (dec_second/3600)

dist = loadtxt("Distance.txt")

for ra in range(754):
    for dec in range(754):
        for dist in range(754):
             x = math.cos(ra) * (dist * math.cos(dec))
             y = math.sin(ra) * (dist * math.cos(dec))
             z = dist * math.sin(dec)
             ax.scatter([x],[y],[z],color="k",s=100)

ax.scatter([0],[0],[0],color="b",s=100)

plt.show()

请有人帮我解决错误消息。谢谢

4

1 回答 1

0

EOFerror 是文件结束错误;如果您的文件之一为空,或者您尝试读取的行数多于文件中的行数,则可能会抛出它。

于 2013-07-19T20:19:09.760 回答