简体   繁体   English

文件太大要导入?

[英]File Too Large to import?

I just wrote this code to fetch the wireshark mac oui database, and I get the following error: 我刚写了这段代码来获取wireshark mac oui数据库,我收到以下错误:

Traceback (most recent call last):
  File "init.py", line 38, in <module>
    main()
  File "init.py", line 27, in main
    import maclist
  File "/home/synthetica/WiJam/maclist.py", line 23753
    'FC:F6:4

however, this is NOT the contents of the file at that line. 但是,这不是该行文件的内容。 Is this a limit of the python intepreter, something I'm overlooking, or something else? 这是python intepreter的限制,我忽略了什么,还是别的什么?

init.py: init.py:

def main():
    #init
     #Load config.
    import localconfig
    print localconfig.name
     #update mac adress db, if at all possible:
    try:
        import maclist
    except:
        import urllib2
        print "Fetching MAC adress db."
        try:
            maclist = urllib2.urlopen(localconfig.url)
        else:
            fl = open("maclist.py","w")
            fl.write("#maclist.py generated by "+localconfig.name+"\n")
            print "Generating maclist.py"
            for line in maclist:
                if "#" in line: line=line[:line.index("#")]
                line = line.split()
                if line and "-" not in line[0]:
                    line=[repr(part) for part in line]
                    line = "=".join(line)
                    fl.write("=".join(line.split())+"\n")
    import maclist



 #start browser

#start web interface
 #handle web interface commands
 #display web interface

if __name__=="__main__":
    main()

localconfig.py localconfig.py

version = "0.3"
name = "Synth's WiJam (version "+version+")"

#maclist related:
url = "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf;hb=HEAD"

Any leads? 任何线索?

@bren maclist.py: Not the full thing, heavens no. @bren maclist.py:不是全部,天哪没有。 It's 20k+ lines. 这是20k +线。

'FC:E1:92'='SichuanJ'
'FC:E1:D9'='StableIm'
'FC:E2:3F'='ClayPaky'
'FC:E5:57'='Nokia'
'FC:E8:92'='Hangzhou'
'FC:ED:B9'='Arrayent'
'FC:F1:CD'='Optex-Fa'
'FC:F5:28'='ZyxelCom'
'FC:F6:47'='Fiberhom'
'FC:F8:AE'='IntelCor'
'FC:F8:B7'='TronteqE'
'FC:FA:F7'='Shanghai'
'FC:FB:FB'='Cisco'

Rewrite maclist.py to be proper python syntax, for example: 重写maclist.py是合适的python语法,例如:

hosts={} 
hosts['FC:FA:F7']='Shanghai'
hosts['FC:FB:FB']='Cisco'

and so on. 等等。

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

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