Solved

socket erroe when invoking python from java app

Posted on 2004-09-09
3
236 Views
Last Modified: 2010-04-16
hi everyone,

I seem to have a winsock error when I tried to invoke my python xml server from within my java application. I know the server works fine because I checked it independently, I also manually started the server and then call the functions from my java app the problem is when I tried to start the python server from within the app I get the following error

Traceback (most recent call last):

  File "C:/Python23/new folder/file.py", line 1307, in ?

    server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8080))

  File "C:\Python23\lib\SimpleXMLRPCServer.py", line 450, in __init__

    SocketServer.TCPServer.__init__(self, addr, requestHandler)

  File "C:\Python23\lib\SocketServer.py", line 329, in __init__

    self.socket_type)

  File "C:\Python23\lib\socket.py", line 154, in __init__

    _sock = _realsocket(family, type, proto)

socket.error: (10091, 'Network subsystem is unvailable')


Any idea on why this happens?

thanks
0
Comment
Question by:jom20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Accepted Solution

by:
cjjclifford earned 50 total points
ID: 12024989
Hi,

Its probably related to runtime environments in this case - when you run the python application from cmdline, and it works, have a look at the environment (particularly around Python related paths/variables, and shared library/DLL paths/variables (its likely that the socket library (winsock?) is a DLL that needs some environment set (I don't use windows, so I can't figure it out completely). The environment that the java program is invoked is not passed on in calls to Runtime.exec(), you have to use the Runtime.exec() method that allows setting environment (i.e. the one with 3 arguments).

Try the following:

list the environment from cmdline.
run the python program
if the program works, unset one of the environment variables.
keep trying till one the program fails for the same reason as it is in Java - this is what needs to be set!

Cheers,
C.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The really strange introduction Once upon a time there were individuals who intentionally put the grass seeds to the soil with anticipation of solving their nutrition problems. Or they maybe only played with seeds and noticed what happened... Som…
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question