Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 977545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:55:11+00:00 2026-05-16T03:55:11+00:00

I’m trying to use Jython (embedded) in a Jetty server (all through Maven) to

  • 0

I’m trying to use Jython (embedded) in a Jetty server (all through Maven) to invoke a simple Python script.

My script works fine as long as I don’t try to use any of the standard library’s such as ‘logging.’ Whenever I try to import one of the standard library’s it fails with the exception “ImportError.”

The exception I get is:

  File "<string>", line 1, in <module>
  File "c:\home\work\sample\content\helloworld\helloworld.py", line 10, in <module>
    import logging
  File "c:\home\work\sample\content\Lib\logging\__init__.py", line 29, in <module>
    import sys, os, types, time, string, cStringIO, traceback
  File "c:\home\work\sample\content\Lib\os.py", line 119, in <module>
    raise ImportError, 'no os specific module found'
ImportError: no os specific module found

    at org.python.core.PyException.fillInStackTrace(PyException.java:70)
    at java.lang.Throwable.<init>(Throwable.java:181)
    at java.lang.Exception.<init>(Exception.java:29)
    at java.lang.RuntimeException.<init>(RuntimeException.java:32)
    at org.python.core.PyException.<init>(PyException.java:46)
    at org.python.core.PyException.doRaise(PyException.java:200)
    at org.python.core.Py.makeException(Py.java:1159)
    at org.python.core.Py.makeException(Py.java:1163)
    at os$py.f$0(c:\home\work\sample\content\Lib\os.py:692)
    at os$py.call_function(c:\home\work\sample\content\Lib\os.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.imp.createFromCode(imp.java:325)
    at org.python.core.imp.createFromPyClass(imp.java:144)
    at org.python.core.imp.loadFromSource(imp.java:504)
    at org.python.core.imp.find_module(imp.java:410)
    at org.python.core.imp.import_next(imp.java:620)
    at org.python.core.imp.import_first(imp.java:650)
    at org.python.core.imp.import_name(imp.java:741)
    at org.python.core.imp.importName(imp.java:791)
    at org.python.core.ImportFunction.__call__(__builtin__.java:1236)
    at org.python.core.PyObject.__call__(PyObject.java:367)
    at org.python.core.__builtin__.__import__(__builtin__.java:1207)
    at org.python.core.__builtin__.__import__(__builtin__.java:1190)
    at org.python.core.imp.importOne(imp.java:802)
    at logging$py.f$0(c:\home\work\sample\content\Lib\logging\__init__.py:1372)
    at logging$py.call_function(c:\home\work\sample\content\Lib\logging\__init__.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.imp.createFromCode(imp.java:325)
    at org.python.core.imp.createFromPyClass(imp.java:144)
    at org.python.core.imp.loadFromSource(imp.java:504)
    at org.python.core.imp.find_module(imp.java:410)
    at org.python.core.imp.import_next(imp.java:620)
    at org.python.core.imp.import_first(imp.java:650)
    at org.python.core.imp.import_name(imp.java:741)
    at org.python.core.imp.importName(imp.java:791)
    at org.python.core.ImportFunction.__call__(__builtin__.java:1236)
    at org.python.core.PyObject.__call__(PyObject.java:367)
    at org.python.core.__builtin__.__import__(__builtin__.java:1207)
    at org.python.core.__builtin__.__import__(__builtin__.java:1190)
    at org.python.core.imp.importOne(imp.java:802)
    at helloworld.helloworld$py.f$0(c:\home\work\sample\content\helloworld\helloworld.py:19)
    at helloworld.helloworld$py.call_function(c:\home\work\sample\content\helloworld\helloworld.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.imp.createFromCode(imp.java:325)
    at org.python.core.imp.createFromPyClass(imp.java:144)
    at org.python.core.imp.loadFromSource(imp.java:504)
    at org.python.core.imp.find_module(imp.java:410)
    at org.python.core.PyModule.impAttr(PyModule.java:109)
    at org.python.core.imp.import_next(imp.java:622)
    at org.python.core.imp.import_name(imp.java:761)
    at org.python.core.imp.importName(imp.java:791)
    at org.python.core.ImportFunction.__call__(__builtin__.java:1236)
    at org.python.core.PyObject.__call__(PyObject.java:367)
    at org.python.core.__builtin__.__import__(__builtin__.java:1207)
    at org.python.core.imp.importFromAs(imp.java:869)
    at org.python.core.imp.importFrom(imp.java:845)
    at org.python.pycode._pyx1.f$0(<string>:1)
    at org.python.pycode._pyx1.call_function(<string>)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.Py.runCode(Py.java:1197)
    at org.python.core.Py.exec(Py.java:1241)
    at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:138)

My scripts looks like:

from java.util import Random
from java.util import Date

import sys

print(sys.path)
print(sys.builtin_module_names)

import logging

logging.basicConfig(level=logging.WARNING)
logger1 = logging.getLogger('aaa') 
logger1.warning('************* This message comes from one module') 

def say_hello():
        return 'hello world1'

I’ve tried the following so far but nothing has worked:

  • Include the zip of the ‘Lib’ directory in my classpath
  • Hard-coding the ‘Lib’ path when i setup the interpreter.

If I do it directly from the interactive Jython shell the script works fine (and a logging message appears).

Thanks.

KJQ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:55:11+00:00Added an answer on May 16, 2026 at 3:55 am

    I think for now i’ve found an answer to my own question…

    Basically, i knew it had something to do with my paths but could not figure out how to do them.

    I ended up creating a “standalone” version of the Jython jar through the installer (and it includes the /Libs directory) and using that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.