Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
12826 Lượt xem

Hello, 

I did a script to import data. I can't access because the connection is refused. 

Look my error : 

Traceback (most recent call last):

File "account.py", line 33, in <module>

uid = sock_common.login(dbname, username, pwd)

File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__

return self.__send(self.__name, args)

File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request

verbose=self.__verbose

File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request

return self.single_request(host, handler, request_body, verbose)

File "/usr/lib/python2.7/xmlrpclib.py", line 1301, in single_request

self.send_content(h, request_body)

File "/usr/lib/python2.7/xmlrpclib.py", line 1448, in send_content

connection.endheaders(request_body)

File "/usr/lib/python2.7/httplib.py", line 997, in endheaders

self._send_output(message_body)

File "/usr/lib/python2.7/httplib.py", line 850, in _send_output

self.send(msg)

File "/usr/lib/python2.7/httplib.py", line 812, in send

self.connect()

File "/usr/lib/python2.7/httplib.py", line 793, in connect

self.timeout, self.source_address)

File "/usr/lib/python2.7/socket.py", line 571, in create_connection

raise err

socket.error: [Errno 111] Connection refused



Thanks



Script : 

import re

import sys, os

import xmlrpclib

import csv

username = "admin"

pwd = "admin"

dbname = "full"

 comp =0

sock_common = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/common")

uid = sock_common.login(dbname, username, pwd)

sock = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/object")

reader = csv.reader(open('Contacts.csv','rb'),delimiter=';')

x = 1 

Ảnh đại diện
Huỷ bỏ

post your script to help you get fixed

Tác giả

import xmlrpclib import csv import re import sys, os username = "admin" pwd = "admin" dbname = "full" comp=0 # pour tester la connexion faudra enlever ce champ sock_common = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/common") uid = sock_common.login(dbname, username, pwd) sock = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/object") reader = csv.reader(open('Contacts.csv','rb'),delimiter=';') x = 1

Câu trả lời hay nhất

Its seems your server is not started so please start the server and check the browser  with http://localhost:8069 if it is  connected and then run the script 

( or)
check with your terminal by 
telnet localhost 8069
 it will return connected to localhost if your server is running 
 else  it will return Connection refused 


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 15
5897
1
thg 2 16
4814
1
thg 3 21
19114
1
thg 5 16
3998
python in v9 Đã xử lý
1
thg 11 15
6110