Python Forum
[SOLVED] OSError: [Errno 22] Invalid argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] OSError: [Errno 22] Invalid argument
#1
When trying to write to a log file, i get the error OSError: [Errno 22] Invalid argument

The code i am using is as follows:
import datetime
import logging
logger = logging.getLogger('k')
hdlr = logging.FileHandler('Path to the log file/Logs/log'+str(datetime.datetime.now())+'.log')
formatter = logging.Formatter('At %(asctime)s, the program returned %(message)s at level %(levelname)s
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
logger.info('Hello')
Self-taught HTML, CSS, Python, and Java programmer
Reply


Messages In This Thread
[SOLVED] OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:03 PM
RE: OSError: [Errno 22] Invalid argument - by wavic - Jun-03-2018, 02:09 PM
RE: OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:10 PM
RE: OSError: [Errno 22] Invalid argument - by wavic - Jun-03-2018, 02:12 PM
RE: OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:15 PM
RE: OSError: [Errno 22] Invalid argument - by wavic - Jun-03-2018, 02:21 PM
RE: OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:24 PM
RE: OSError: [Errno 22] Invalid argument - by wavic - Jun-03-2018, 02:30 PM
RE: OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:31 PM
RE: OSError: [Errno 22] Invalid argument - by buran - Jun-03-2018, 02:39 PM
RE: OSError: [Errno 22] Invalid argument - by Panda - Jun-03-2018, 02:51 PM
RE: OSError: [Errno 22] Invalid argument - by wavic - Jun-03-2018, 02:41 PM
RE: OSError: [Errno 22] Invalid argument - by buran - Jun-03-2018, 02:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  OSError occurs in Linux. anna17 2 388 Mar-23-2024, 10:00 PM
Last Post: snippsat
  Invalid argument: 'images\x08ackground.jpg' CatBall 4 1,034 Jun-19-2023, 09:28 AM
Last Post: CatBall
  OSError with SMPT script Milan 0 837 Apr-28-2023, 01:34 PM
Last Post: Milan
  OSERROR When mkdir Oshadha 4 1,856 Jun-29-2022, 08:50 AM
Last Post: DeaD_EyE
  [split] [Errno 22] Invalid argument Junaid 0 2,318 Jun-12-2021, 06:02 PM
Last Post: Junaid
  [solved] Variable number of dictionnaries as argument in def() paul18fr 11 6,267 Apr-20-2021, 11:15 AM
Last Post: paul18fr
  OSError: Unable to load libjvm when connecting to hdfs with pyarrow 3.0.0 aupres 0 3,214 Mar-22-2021, 10:25 AM
Last Post: aupres
  pyarrow throws oserror winerror 193 1 is not a valid win32 application aupres 2 3,852 Oct-21-2020, 01:04 AM
Last Post: aupres
  [Errno 22] Invalid argument satyaneel 11 106,701 Jul-14-2020, 08:47 AM
Last Post: lichunming
  zlib decompress error: invalid code lengths set / invalid block type DreamingInsanity 0 6,946 Mar-29-2020, 12:44 PM
Last Post: DreamingInsanity

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020