5

I have python 3.5, tried to install logging package in PyCharm, I got an error:

Error occured when installing package 'logging' Make sure that you use a version of Python supported by this package. Currently you are using Python 3.5.

import logging
logging.warning('Watch out!')
logging.info('I told you so') 

UPDATE:

If it is included why I got this:

Traceback (most recent call last):
  File "C:/Users/alotfi/PycharmProjects/firstProj/logging.py", line 1, in <module>
    import logging
  File "C:\Users\alotfi\PycharmProjects\firstProj\logging.py", line 2, in <module>
    logging.warning('Watch out!')
AttributeError: module 'logging' has no attribute 'warning'

Process finished with exit code 1

Thanks.

3
  • 1
    What do you mean by 'installing' logging? It's a module in the standard library included in a base install.... Commented Sep 29, 2015 at 15:41
  • I have exactly the same error when running exactly the same examples. I have no idea why the error occurred. This question shouldn't be closed. It is very clear. Why the error occurred if it is standard library? Commented May 22, 2016 at 18:58
  • you named your file logging.py, the interpreter is looking for an attribute warning in your file, not in the module you intended to import Commented May 14, 2021 at 1:32

1 Answer 1

6

Logging is a standard package for python 3.5 this means that there is no reason to install it.

Sign up to request clarification or add additional context in comments.

5 Comments

APDATED my question, if it's included why I got that error ?
always the same : AttributeError: module 'logging' has no attribute 'warn'
This answer explains nothing. The Logging module is a standard package and still running first example from documentation gives an error like logging wouldn't be installed. WHY?
Well, the real answer seems to be quite simple: @user1034127, @tomasz74: The original poster seems to have saved his example script as logging.py. That's why it fails. Never give a script the same name as an existing module. If you import logging, you just import your own script. Give it another name and cheer up.
@absurd, you are completely right. answer seems odd is simply because author modified question after I posted my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.