I'm learning Python and am following the book A byte of python. In an exercise talking about the logging module there is the following line of code:
if platform.system().startswith('Windows'):
logging_file = os.path.join(os.getenv('DIRETORIOINICIAL'), os.getenv('PATH'), 'test.log')
The script only writes within the file teste.log
with the date and time the script was run.
I followed exactly how it is in the book but I always get the same trackback:
Traceback (most recent call last):
File "using_logging.py", line 6, in <module>
logging_file = os.path.join(os.getenv('DIRETÓRIOINICIAL'), os.getenv('PATH'), 'test.log')
File "C:\Python34\lib\ntpath.py", line 108, in join
result_drive, result_path = splitdrive(path)
File "C:\Python34\lib\ntpath.py", line 159, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()
It does not return or write the file.