Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with time entry #292

Closed
mohamedmamdouh1 opened this issue Jun 11, 2023 · 7 comments
Closed

Error with time entry #292

mohamedmamdouh1 opened this issue Jun 11, 2023 · 7 comments

Comments

@mohamedmamdouh1
Copy link

Dears,

this issue occur only when ERPmine plugin is installed:
When I'm trying to create time entry using API:

from redminelib import Redmine

redmine = Redmine('http://10.2.0.255/', username='admin', password='')
issue = redmine.issue.get(5)
time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue maxtepkeev/python-redmine#1')

then I receive this error:
File "d:\test.py", line 47, in
time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue maxtepkeev/python-redmine#1')
File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 192, in create
resource = self._process_create_response(request, response)
File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 206, in _process_create_response
return self.to_resource(response[self.container])
KeyError: 'time_entry'

@cdhana17
Copy link
Collaborator

Can you check the error in the redmine log and post it here ?

@mohamedmamdouh1
Copy link
Author

I, [2023-06-14T14:56:25.965163 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Started GET "/issues/26049.json" for 10.2.0.10 at 2023-06-14 14:56:25 +0000
I, [2023-06-14T14:56:25.965652 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Processing by IssuesController#show as JSON
I, [2023-06-14T14:56:25.965679 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Parameters: {"id"=>"26049"}
I, [2023-06-14T14:56:26.041084 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Current user: MHASSAN (id=184)
I, [2023-06-14T14:56:26.076166 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Rendered issues/show.api.rsb (Duration: 8.2ms | Allocations: 2498)
I, [2023-06-14T14:56:26.076414 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Completed 200 OK in 111ms (Views: 7.5ms | ActiveRecord: 35.3ms | Allocations: 16786)
I, [2023-06-14T14:56:26.083746 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Started POST "/time_entries.json" for 10.2.0.10 at 2023-06-14 14:56:26 +0000
I, [2023-06-14T14:56:26.084267 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Processing by TimelogController#create as JSON
I, [2023-06-14T14:56:26.084301 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Parameters: {"time_entry"=>{"issue_id"=>26049, "hours"=>2, "activity_id"=>8, "comments"=>"Worked on issue #1"}}
I, [2023-06-14T14:56:26.122407 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Current user: MHASSAN (id=184)
I, [2023-06-14T14:56:26.194192 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Completed 200 OK in 110ms (Views: 0.1ms | ActiveRecord: 57.0ms | Allocations: 13575)

@cdhana17
Copy link
Collaborator

The log says, it completed successfully, it may be an error in python, can you check your python code ?

@mohamedmamdouh1
Copy link
Author

This is the python code:

from redminelib import Redmine

redmine = Redmine('http://10.2.0.200/', username='mhassan', password='')
issue = redmine.issue.get(26049)
time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue #1')

@cdhana17
Copy link
Collaborator

I don't see any issues with this python code, do you want to see for any errors in the line below it ? may be try to print debug statements

@mohamedmamdouh1
Copy link
Author

mohamedmamdouh1 commented Jun 21, 2023

I receive this error:
File "d:\test.py", line 47, in
time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='")
File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 192, in create
resource = self._process_create_response(request, response)
File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 206, in _process_create_response
return self.to_resource(response[self.container])
KeyError: 'time_entry'

@cdhana17
Copy link
Collaborator

This looks like a python error, you will probably have to get support else where

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants