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 8638949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:52:20+00:00 2026-06-12T10:52:20+00:00

I am trying to run a Python class through C# .NET using IronPython, a

  • 0

I am trying to run a Python class through C# .NET using IronPython, a couple of the Modules imported by the Python class are:

import collections
import nltk.classify.util

In order to import these when running IronPython, I am using the GetSearchPath collection of the ScriptEngine to add the path to the location of the Python library, as such:

ICollection<string> paths = pyEngine.GetSearchPaths();
string dir = @"C:\Python27\Lib\";
paths.Add(dir);
string dir2 = @"C:\Python27\Lib\site-packages\nltk\classify\";
paths.Add(dir2);
pyEngine.SetSearchPaths(paths);

This seems to run fine for the collections Module, but not the nltk.classify.util, and I get the following error when calling the Execute method of the ScriptEngine:

No module named nltk.classify.util

Even tho the util module lives in the path specified above. I take it the issue has to do with the way the import is specified in the Python class (‘.’ delimited), just not sure how to solve it. Any ideas where am going wrong?

  • 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-12T10:52:22+00:00Added an answer on June 12, 2026 at 10:52 am

    Python uses the structure of a package name to search for a module, so if you ask for nltk.classify.util it will look for nltk\classify\util.py starting from each directory in the search path.

    So in your example, you want to change dir2 as follows:

    string dir2 = @"C:\Python27\Lib\site-packages";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a python script using :- python scriptname.py someoptions When
I'm trying to run NeHe's tutorial here using Python 2.7.3, but It's throwing the
I am trying to run a simple linear regression (using rpy2 from Python) and
In Python, I'm trying to run a method in a class and I get
I am trying to run a website using Python 2.7.1, Jinja 2.5.2, and CherryPy
I'm trying to run a snippet of Python from within Java, using Jython. If
I am getting error when trying to run Python socket http server. import SocketServer
I am trying to run an ftp server in python using pyftpdlib module. The
I am trying to run an awk script using python, so I can process
I'm trying to run a python application from source, and it has: from shader

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.