top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Error running xmlrpc Client and server under different Python versions

0 votes
411 views

I need to run xmlrpc Server under Python 3.3 and Client under Python 2.7. But when I try to do so, I receive the following exception:

":global name 'xmlrpclib' is not defined"

What is the reason for such an exception. As far as I understand xmlrpc is language independent.

posted Jun 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

Somewhere in your code you are trying to use the name xmlrpclib but it was not imported or otherwise assigned to. Search through your code to find the usage.

> What is the reason for such an exception. As far as I understand xmlrpc is language independent. Please help. 

The fact that it is language independent is irrelevant since this is a code error.

answer Jun 20, 2013 by anonymous
0 votes
answer Jun 20, 2013 by anonymous
Similar Questions
0 votes

Fedora 18

Where do I find the setuptools module ? For error below

$python setup.py install

Traceback (most recent call last):
 File "setup.py", line 2, in 
 from setuptools import setup, find_packages
ImportError: No module named setuptools

Below is the setup.py

#!/usr/bin/env python
from setuptools import setup, find_packages

setup(name="python-instagram",
 version="0.8.0",
 description="Instagram API client",
 license="MIT",
 install_requires=["simplejson","httplib2"],
 author="Instagram, Inc",
 author_email="apidevelopers@instagram.com",
 url="http://github.com/Instagram/python-instagram",
 packages = find_packages(),
 keywords= "instagram",
 zip_safe = True)
0 votes

i want to sent a response for my form submit from server to client, that means python flask to javascript. My javascript code is given follows

document.addEventListener('DOMContentLoaded', function() {

chrome.tabs.getSelected(null, function(tab) {
  d = document;
  var f = d.createElement('form');
  f.action = 'http://127.0.0.1:5000/Get%20Form/';
  f.method = 'post';
  var i = d.createElement('input');
  i.type = 'hidden';
  i.name = 'url';
  i.value = tab.url;
  f.appendChild(i);
  d.body.appendChild(f);
  f.submit();   
});
$(".button").click(function(){
    request = new XMLHttpRequest();
    request.open("POST","http://127.0.0.1:5000/PutValue/",true);
    request.send();
    request.addEventListener("readystatechange", processRequest,false);
    function processRequest(e)
    {
    if(request.readyState==4 && request.status == 200)
    {
    var response = JSON.parse(request.responseText);
    a=response.result
    alert(a);
    }
    }
});
},false);

And my Python server code is follows

from flask import Flask, flash, redirect, url_for, request, render_template,jsonify
import json
import UrlTest
import trainingSet as ts

app = Flask(__name__)
user=""
s=0

@app.route('/Get Form/',methods = ['POST'])
def GetForm():
request.method == 'POST'
url=request.form['url']
UrlTest.process_test_url(url,'test_features.csv')
s=ts.main_caller('url_features.csv','test_features.csv')
print s
return str(s)

@app.route('/PutValue/',methods = ['POST'])
def PutValue():
request.method == 'POST'
print s
return jsonify(result=s)


if (__name__ == '__main__'):
app.run(debug=True,host='0.0.0.0', use_reloader=False)

I want to send the value of s to the javascript client. please help me to send this the value of s.
and if u can suggest the complete code in javascipt and python

+2 votes

I have two Questions:

  1. Could Python 3.2, when compiled against OpenSSL 1.0.0j, be affected by the poodle bug? https://www.openssl.org/~bodo/ssl-poodle.pdf

  2. If yes - are the following OpenSSL versions approved for use with Python 3.2:
    OpenSSL 0.9.8zf
    OpenSSL 1.0.0r
    OpenSSL 1.0.1m
    OpenSSL 1.0.2a

+1 vote

I'm using Python 2.7 under Windows and am trying to run a command line program and process the programs output as it is running. A number of web searches have indicated that the following code would work.

import subprocess

p = subprocess.Popen("D:PythonPython27Scriptspip.exe list -o",
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT,
 bufsize=1,
 universal_newlines=True,
 shell=False)
for line in p.stdout:
 print line

When I use this code I can see that the Popen works, any code between the Popen and the for will run straight away, but as soon as it gets to the for and tries to read p.stdout the code blocks until the command
line program completes, then all of the lines are returned. Does anyone know how to get the results of the program without it blocking?

...