Python Forum
KeyError issue - unable to find root cause
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KeyError issue - unable to find root cause
#11
Hi Buran -

Not quite - I do not do anything manually. Within my ticketing system, there is a "Custom Schedule" module where it runs a query behinds the scenes (Sql query). Then the output of that (i assume JSON format) is passed as an argument - see picture.

[Image: Vh4nCu]

The screen shot in my previous post is the "module" which runs the query - I did it manually so I could show you.
Reply
#12
in this case I don't know how we can help you - we don't know how your input data look like and why there is no emialid key. ignore my previous post if it is not csv file.

you can print workorder_list to see if you can guess what you are working with
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#13
This isn't printing:
print(workorder_list)
Am I doing it wrong?
Reply
#14
Hi Folks -
Just wanted to bring this to the top. I did some more testing and the sys argument is as follows:
Quote:C:\ManageEngine\ServiceDesk\bin\..\integration\custom_schedule_reports\15301_csh.json

So, in fact, the argument passed is the json file called "15301_csh.json". This file (as shown above) is comprised of there columns persay with the following headings - in this order:
workorderid
emailid
createdtime

Does that help clear things up a bit? I'm still getting the following error:
Quote:Schedule : Aging_Open_Requests executed, Result: Traceback (most recent call last):
File "date_diff.py", line 17, in <module>
date = getdate(req['createdtime'])
KeyError: 'createdtime'

It seems as though it can't get the 'createdtime' column value in the json file. Any ideas?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  unable to find module in su mode? korenron 2 1,930 Jan-10-2021, 07:41 PM
Last Post: Gribouillis
  Cant find root cause of thread.lock error burlyboys 0 1,563 May-18-2020, 12:51 PM
Last Post: burlyboys
  Unable to find an existing module arbiel 2 4,977 Apr-11-2020, 07:12 PM
Last Post: arbiel
  unable to pass a input after changing the user from root to non root using python avinash 3 3,207 Apr-08-2019, 10:05 AM
Last Post: avinash
  How to ignore - ERROR: The system was unable to find the specified registry key or va asheru93 9 6,684 Feb-04-2019, 06:35 AM
Last Post: asheru93
  unable to find vcvarsall.bat nithya 1 4,029 Jan-03-2018, 08:25 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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