Error using pydev protocol from Pydev

I am using PyDev with Python 3.5 from the installation of Aptana. Everything worked fine until I decided to study the registration module, which I had never used before. I started with a new script from the tutorial:

import logging
logging.warning('Watch out!')  # will print a message to the console
logging.info('I told you so')  # will not print anything

in Pydev I have this error:

Traceback (most recent call last):
  File     "C:\Users\Tomasz\workspace\basicLogging.py", line 7, in <module>
    logging.warning('Watch out!')  # will print a message to the console
AttributeError: module 'logging' has no attribute 'warning'

I searched and found questions such as: python: install a registration module with a similar problem, but without a solution. Obviously, the problem is not installation. When I run the exact same script from CMD, I have the correct output. At the moment, it seems that Pydev is giving me an error in most of my scripts. If I go back to code that used to work fine, now I have this:

Traceback (most recent call last):
  File "C:\Users\Tomasz\workspace\piClientFullQt.py", line 15, in <module>
    from matplotlib.backends import qt_compat
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\__init__.py", line 122, in <module>
    from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\cbook.py", line 33, in <module>
    import numpy as np
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\__init__.py", line 180, in <module>
    from . import add_newdocs
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\core\__init__.py", line 58, in <module>
    from numpy.testing.nosetester import _numpy_tester
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\testing\__init__.py", line 10, in <module>
    from unittest import TestCase
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\unittest\__init__.py", line 59, in <module>
    from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
  File "C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\lib\unittest\case.py", line 273, in <module>
    class _CapturingHandler(logging.Handler):
AttributeError: module 'logging' has no attribute 'Handler'

, . print(sys.executable), C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\python3.exe , CMD , Pydev .

python Pydev ( ), , .

EDIT:

python , , ,

C:\Users\Tomasz>python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
C:\Users\Tomasz\AppData\Local\Programs\Python\Python35-32\Lib\site-packages

- System PYHONPATH

→ → PyDev → Iterpreters → Python Interpreter

EDIT: @Samuel, :

import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

logging.warning('Watch out!')  # will print a message to the console
logging.info('I told you so')  # will not print anything

PyDev :

Traceback (most recent call last):
  File "C:\Users\Tomasz\workspace\SCT2python\goodExamps\logging\basicLogging.py", line 3, in <module>
    logger = logging.getLogger()
AttributeError: module 'logging' has no attribute 'getLogger'

, script!!

: @Samuel , ! , , , "". , !

+4
1

:

import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

logger.warning('Watch out!') 
logger.info('I told you so')
+1

All Articles