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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:13:26+00:00 2026-06-06T07:13:26+00:00

I am having trouble importing python packages only when running python from cmdline/console. However,

  • 0

I am having trouble importing python packages only when running python from cmdline/console. However, when using pydev, everything seems to work fine.

I have the following filesystem…

---MarketData
   ---Parser
      ---Parser.py
      ---__init__.py
   ---IO
      ---__init__.py
      ---MarketSocket.py

Currently, Parser and IO are defined as python packages (they have init.py files, although there is no code in the Parser.init.py file.

I am trying to run the following line of code in MarketSocket.py

from Parser import Parser

Which should import the module ‘Parser’ within the package ‘Parser’ however, I get the following error.

ImportError: No Module Named Parser

Any help would be appreciated! This should work according to similar issues on stackOverflow, but for some odd reason it isn’t.

  • 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-06T07:13:27+00:00Added an answer on June 6, 2026 at 7:13 am

    MarketSocket.py is in the directory IO. Therefore it is not possible to find the package Parser.

    The best way to resolve this, are relative imports: from ..Parser import Parser But they might not work, if you start the script like: python MarketSocket.py. To use this, you would also have to add an __init__.py to your MarketData directory.

    If it doesn’t work extend the sys.path like this:

    import sys
    sys.path.append('../')
    

    With this addition, Python searches also the paths you want.

    If I were you I would also think about restructuring your project. In my opinion executables should be (most of the time) at the top of your working tree, which is also like Python works.

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

Sidebar

Related Questions

I'm just getting started with twisted.web, and I'm having trouble importing a Python module
I'm having trouble with merging two datasets. I'm using SAS 9.2 and when importing
I'm trying to learn python and I'm having trouble importing a module. I have
I'm having trouble importing definitions from modules in Coq. I'm new to Coq, but
I am using the Enthought Python Distribution v7.0-2 (32-bit) and I am having trouble
I'm having trouble importing packages into package objects. It didn't seem to work in
I am having some trouble importing a class from a particular module. The class
I seem to be having a bit of trouble with using classes from other
I'm using java from command line and coding in gedit, and am having trouble
I'm exploring mod_python and I'm having trouble with the package importing. I've a structure

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.