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

  • SEARCH
  • Home
  • 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 8521679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:53:40+00:00 2026-06-11T06:53:40+00:00

I’m writing a basic test with nose to call a single function from a

  • 0

I’m writing a basic test with nose to call a single function from a logging wrapper, but once I got the test to be discovered I started getting standard library module import errors.

This is the code I’m trying to write some tests for and has been in production and hasn’t changed in a long time, so I’m sure the there’s something wrong when how I’m trying to use nose.

  Failure: ImportError (cannot import name WatchedFileHandler) ... ERROR

  ======================================================================
  ERROR: Failure: ImportError (cannot import name WatchedFileHandler)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/opt/local/lib/python2.4/site-packages/nose/loader.py", line 389, in loadTestsFromName
      module = self.importer.importFromPath(
    File "/opt/local/lib/python2.4/site-packages/nose/importer.py", line 39, in importFromPath
      return self.importFromDir(dir_path, fqname)
    File "/opt/local/lib/python2.4/site-packages/nose/importer.py", line 86, in importFromDir
      mod = load_module(part_fqname, fh, filename, desc)
    File "/Users/jolson/project/qworker/tests/unit/test_qscript_log.py", line 2, in ?
      from logging.handlers import WatchedFileHandler, TimedRotatingFileHandler
  ImportError: cannot import name WatchedFileHandler

What could cause this?

Update:
I’ve simplified it to the following and the test still fails, but outside of nose, this all works as expected.

from logging.handlers import WatchedFileHandler, TimedRotatingFileHandler

def test_INFO():
    assert 0 == 0

** Update 2 **
I’ve checked my paths. Inside the nosetests, my path looks like this.

['/Users/jolson/project/qworker/tests', '/Users/jolson/project/qworker',
'/opt/local/bin', '/opt/local/lib/python24.zip', '/opt/local/lib/python2.4', 
'/opt/local/lib/python2.4/plat-darwin', '/opt/local/lib/python2.4/plat-mac', 
'/opt/local/lib/python2.4/plat-mac/lib-scriptpackages', '/opt/local/lib/python2.4/lib-tk',
 '/opt/local/lib/python2.4/site-packages/readline', '/opt/local/lib/python2.4/lib-dynload', 
'/opt/local/lib/python2.4/site-packages', '/opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg-info']

but my normal path inside the python interpreter is

['', '/usr/local/bin', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', 
'/Library/Python/2.7/site-packages/virtualenv-1.8.2-py2.7.egg', 
'/Library/Python/2.7/site-packages/virtualenvwrapper-3.6-py2.7.egg', 
'/Library/Python/2.7/site-packages/stevedore-0.3-py2.7.egg', 
'/Library/Python/2.7/site-packages/virtualenv_clone-0.2.4-py2.7.egg',
 '/Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', 
'/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info', 
'/Library/Python/2.7/site-packages/IPython/extensions']

I’m running nosetests-2.4 tests

which has one file in tests/unit/test_log.py

  • 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-06-11T06:53:41+00:00Added an answer on June 11, 2026 at 6:53 am

    My os was defaulting to nosetests-2.4 which uses python 2.4, but all our code is python 2.7, so that’s why the path was wrong and nothing was working and logging.handlers was just the first package that was missing from 2.4 libs that was needed.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms

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.