Python Forum
no protocol header version error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
no protocol header version error
#1
excuse me.

i am new in python programming language

i try to input data from csv file to hadoop hbase with python script

but everytime i try to compile the script, the script always return me the error like "NO PROTOCOL HEADER VERSION" .

anybody knows what can i do to solve that ?

this is my script
import xlrd
import csv
import happybase
import time
import errno
import sys

batch_size=1000
host="myhost "
file_path="2005.csv"
row_count=0
start_time = time.time()
table_name = "testing_xls"

def connect_to_hbase():
    #connect to HBase server
    conn=happybase.Connection(host=host,
    table_prefix_separator=":",
    autoconnect=False)
    conn.open()
    print(conn.tables())
    table=conn.table(table_name)
    batch=table.batch(batch_size=batch_size)
    return conn,batch

def insert_row(batch,row):
    #insert row to hbase 
     batch.put(row[0],{"xls:tahun":row[1],"xls:gelombang":row[2],"xls:nama":row[3],
    "xls:jumlah_pilihan":row[4],"xls:pilihan1":row[5],"xls:pilihan2":row[6],
    "xls:kode_sekolah":row[7],"xls:nama_Sekolah":row[8],"xls:kota_sekolah":row[9],
    "xls:alamat_sekolah":row[10],"xls:nim":row[11],"xls:nilai1":row[12],
    "xls:nilai2":row[13],"xls:status":row[14],"xls:terima_fakultas":row[15],
    "xls:keterangan":row[16]})

def read_csv():
    #read the csv file from path
    csvfile=open(file_path,"r")
    csvreader=csv.reader(csvfile)
    return csvreader,csvfile

conn,batch = connect_to_hbase()
print "Connect to Hbase. Table name : %s, bacthsize %i" % (table_name,batch_size)
csvreader,csvfile = read_csv()
print "Connected to file. name : %s" % (file_path)

try:
    for row in csvreader:
        row_count += 1
    insert_row(batch,row)

    batch.send()
except IOError as e:
    if e.errno == errno.EPIPE:
    print "error broken pipe catched"

finally:
    csvfile.close()
    conn.close()

duration = time.time() - start_time
print "Done. row count : %i, duration %.3f s" % (row_count,duration)
thank you very much, please help if you can help me..
Reply
#2
Quote:script always return me the error like "NO PROTOCOL HEADER VERSION" .

Please post the actual (and complete) error traceback varbatim
it contains very valuable information about the error context

Thank you
Reply
#3
If only there was some sort of place people could go to find information.
Some sort of network of libraries, each interconnected to each other.
Something that was easy to use, where anyone in the world could find information from anyone else in the world, at any time of day.

Oh wait. http://bfy.tw/9slI
The very first result says you probably need some sort of authentication. From your code snippet, you don't have any auth at all setup. It'd be a pretty bad system if anyone could connect to any hadoop database.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Paramiko Server -- Exception (server): Error reading SSH protocol banner ujlain 3 4,274 Jul-24-2023, 06:52 AM
Last Post: Gribouillis
  Can I use Python in ns3 simulator to create an IGP routing protocol? leemao 1 8,170 Jun-30-2021, 07:20 PM
Last Post: leemao
  Handle http protocol JohnnyCoffee 1 5,509 Jun-20-2021, 06:51 AM
Last Post: ndc85430
  How to extract protocol from a pcap file ? salwa17 0 2,198 Apr-02-2020, 10:02 PM
Last Post: salwa17
  Is there in 2018 a python3 library that implements the Internet Printing Protocol? AFoeee 1 4,076 Jun-07-2019, 08:51 AM
Last Post: heiner55
  accessing SOAP protocol page secured with cetrificad lopow 3 5,510 Jan-11-2017, 03:14 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020