Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing date time
#8
I could start a new thread but what I thought was a no brainer add on to the code above has proven to be problematic. The initial code found the desired record by subject and date, once found I thought all I would have to do is the following to write any attachments to a folder of my choosing.

I'm not sure where I've gone off the rails here!

 while True:
                attachment = message.Attachments
                attachment_items = attachment.Count
                x = 1
                while x <= attachment_items:
                    attachment = attachment.item(x)
                    attachment.SaveAsFile('C:\\BarTender' + '\\'+ str(attachment)) 
                break    
Error:
File "c:\Users\cartken\Downloads\py\inbox scanner.py", line 36, in <module> attachment = attachment.item(x) File "C:\Python\lib\site-packages\win32com\client\dynamic.py", line 527, in __getattr__ raise AttributeError("%s.%s" % (self._username_, attr)) AttributeError: <unknown>.item
Been one of those 'daze'.
Through a cloudy window,
Kip...

“Progress means getting nearer to the place you want to be. And if you have taken a wrong turn, then to go forward does not get you any nearer.
If you are on the wrong road, progress means doing an about-turn and walking back to the right road; and in that case the man who turns back soonest is the most progressive man.” ― C.S. Lewis
Reply


Messages In This Thread
Parsing date time - by KipCarter - Mar-05-2020, 06:00 PM
RE: Parsing date time - by Larz60+ - Mar-05-2020, 10:08 PM
RE: Parsing date time - by KipCarter - Mar-06-2020, 11:12 AM
RE: Parsing date time - by Larz60+ - Mar-06-2020, 01:20 PM
RE: Parsing date time - by DeaD_EyE - Mar-06-2020, 01:48 PM
RE: Parsing date time - by KipCarter - Mar-06-2020, 03:20 PM
RE: Parsing date time - by DeaD_EyE - Mar-06-2020, 03:49 PM
RE: Parsing date time - by KipCarter - Mar-06-2020, 06:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 1,949 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Date Time Series Help...Please spra8560 2 1,236 Feb-01-2024, 01:38 PM
Last Post: spra8560
  Python date format changes to date & time 1418 4 2,610 Jan-20-2024, 04:45 AM
Last Post: 1418
  Downloading time zone aware files, getting wrong files(by date))s tester_V 9 2,767 Jul-23-2023, 08:32 AM
Last Post: deanhystad
  Formatting a date time string read from a csv file DosAtPython 5 4,994 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  Wait til a date and time KatManDEW 2 2,094 Mar-11-2022, 08:05 PM
Last Post: KatManDEW
  Date format and past date check function Turtle 5 9,834 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  How to add previous date infront of every unique customer id's invoice date ur_enegmatic 1 2,826 Feb-06-2021, 10:48 PM
Last Post: eddywinch82
  Naming the file as time and date. BettyTurnips 3 4,610 Jan-15-2021, 07:52 AM
Last Post: BettyTurnips
  Update Date based on Time/String stevezemlicka 1 2,614 Jan-08-2021, 06:54 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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