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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:19:28+00:00 2026-05-28T08:19:28+00:00

It seems like Pycharm 1.5.3 makes some magic, or I missed something. I have

  • 0

It seems like Pycharm 1.5.3 makes some magic, or I missed something.

I have following file structure:

/sp
/sp/tools.py
/sp/test/main.py

Files contain following code

main.py:

__author__ = 'username'
import tools
import sys

def test1():
    print locals()
    print globals()
    print sys.path
    print test1

if __name__ == '__main__':
    test1()

tools.py:

class SettingsDictionary(dict):
    def __init__(self, seq, **kwargs):
        dict.__init__(self, seq, **kwargs)

When I run main.py this is written in console:

C:\Python27\python.exe D:/Workspace/Python/sp/test/main.py
{}
{'test1': <function test1 at 0x0143D0B0>, '__warningregistry__': {("Not importing directory 'C:\\Program Files\\JetBrains\\PyCharm 1.5.3\\helpers\\tools': missing __init__.py", <type 'exceptions.ImportWarning'>, 2): True}, '__builtins__': <module '__builtin__' (built-in)>, '__file__': 'D:/Workspace/Python/sp/test/main.py', '__author__': 'p.grechishkin', 'sys': <module 'sys' (built-in)>, '__name__': '__main__', '__package__': None, 'tools': <module 'tools' from 'D:\Workspace\Python\sp\tools.pyc'>, '__doc__': None}
['D:\\Workspace\\Python\\sp\\test', 'C:\\Python27\\lib\\site-packages\\simplejson-2.1.6-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django_staticfiles-1.1.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django_appconf-0.4-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\suds-0.4-py2.7.egg', 'C:\\Program Files\\JetBrains\\PyCharm 1.5.3\\helpers', 'D:\\Workspace\\Python\\sp', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin']
<function test1 at 0x0143D0B0>

Process finished with exit code 0

I don’t understand why import function knows about this module ‘tools’: .
When I run this script from windows cmd – everything is okay. I get ‘ImportError: No module named tools’

  • 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-28T08:19:29+00:00Added an answer on May 28, 2026 at 8:19 am

    The import work in the example you provided because your python path contains D:\\Workspace\\Python\\sp which is where your tools module is.

    When you run a module from standard python interpreter, it only adds the path to current module in sys.path.

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

Sidebar

Related Questions

Seems like I may have missed something simple in the syntax, but I'd like
Seems like a simple issue but I'm obviously missing something. I have a ViewBag
Seems like this is a dumb question, but I need something... substantial. I have
Seems like I should be able to get at it through HAT or something
Seems like more companies are using Ruby on Rails nowadays. What are some other
Seems like in Perl this should be easy or a module, but I have
Seems like I've ran into a wall here. I want some datasource to be
Seems like this is the kind of thing that would have already been answered
Seems like this should be something straightforward, but I haven't been able to get
Seems like I may be missing to set some enviornment variable in my AppHarbor

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.