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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:35:41+00:00 2026-06-10T21:35:41+00:00

I am pretty new to Python. Currently I am trying out PyCharm and I

  • 0

I am pretty new to Python. Currently I am trying out PyCharm and I am encountering some weird behavior that I can’t explain when I run tests.

The project I am currently working on is located in a folder called PythonPlayground. This folder contains some subdirectories. Every folder contains a init.py file. Some of the folders contain nosetest tests.

When I run the tests with the nosetest runner from the command line inside the project directory, I have to put “PythonPlayground” in front of all my local imports. E.g. when importing the module called “model” in the folder “ui” I have to import it like this:

from PythonPlayground.ui.model import *

But when I run the tests from inside Pycharm, I have to remove the leading “PythonPlayground” again, otherwise the tests don’t work. Like this:

from ui.model import *

I am also trying out the mock framework, and for some reason this framework always needs the complete name of the module (including “PythonPlayground”). It doesn’t matter whether I run the tests from command line or from inside PyCharm:

with patch(‘PythonPlayground.ui.models.User’) as mock:

Could somebody explain the difference in behavior to me? And what is the correct behavior?

  • 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-10T21:35:43+00:00Added an answer on June 10, 2026 at 9:35 pm

    I think it happens because PyCharm have its own “copy” of interpreter which have its own version of sys paths where you project’s root set to one level lower the PythonPlayground dir.
    And you could find preferences of interpreter in PyCharm fro your project and set proper top level.
    ps. I have same problems but in Eclipse + pydev

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

Sidebar

Related Questions

I'm pretty new to Python, so if there's anything here that's flat-out bad, please
I'm trying to learn python, and I'm pretty new at it, and I can't
I'm pretty new to python (couple weeks into it) and I'm having some trouble
I am pretty new to python and working with firmata I am trying to
I'm pretty new to Python programming and would appreciate some help to a problem
I'm pretty new to Python and App Engine, but what I'm trying to do
I am pretty new to python. I need to create a class that loads
Audio processing is pretty new for me. And currently using Python Numpy for processing
I am pretty new to python and am hitting an issue I cannot explain.
I am pretty new to Subversion, and not that experienced in Python, but am

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.