On Friday, November 21, 2014 4:29:48 AM UTC-6, Tim Chase wrote: > What messed-up version of Python are you running? > Or did you fail to test your conjecture? > > $ cat > calendar.py > print("This is my local calendar.py") > x=1 > $ cat > importtest.py > import calendar > print(dir(calendar)) > $ python2 importtest.py > This is my local calendar.py > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'x'] > $ python3 importtest.py > This is my local calendar.py > ['__builtins__', '__cached__', '__doc__', '__file__', '__name__', > '__package__', 'x'] > > It finds my local module, not the system "calendar" module.
You failed to provide the needed information! 1. We need to see the values in sys.path. So print them directly before making the call to import. 2. Where did you store your custom "calendar.py" script? Remember, "import" is an implicit mechanism, it works by searching the values of 'sys.path' one-by-one (if the module was not already loaded!) until the *FIRST* module matching the name you requested is found. If the folder that holds *your* custom "calendar.py" script is listed *before* the folder containing the "python calendar" modules then of course your module will be correctly loaded. -- https://mail.python.org/mailman/listinfo/python-list