error in python in function arguments (again XD) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

error in python in function arguments (again XD)

Hi I have a question regarding a code and it is pose detection. When I try to execute the complete code that is this it gives me an error that I do not understand how to solve it, please could you help me in this problem. In this code the following packages are used: mediapipe, opencv, time and math Added information to better understand the situation Now I explain the error calmly, I use the direct python idl to execute this code or also by system symbol, and when executing it, it indicates the following error: TypeError: create_bool (): incompatible function arguments. The following argument types are supported: 1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet But I know the code is fine but I can't get it to run that's why I've come here to the community to ask if anyone knows this type of code https://code.sololearn.com/cRG55yPF9i9f/#py

4th Sep 2021, 7:28 PM
Jcrex
Jcrex - avatar
24 Answers
+ 6
You can edit your post when you click on the 3 dots – no need to create a new thread. https://www.sololearn.com/Discuss/2874412/?ref=app Which error did you get? Did you try to run it on sololearn?
4th Sep 2021, 7:31 PM
Lisa
Lisa - avatar
+ 4
The error hints at line 15 of your script, I think
4th Sep 2021, 7:54 PM
Lisa
Lisa - avatar
+ 3
What is mp.solutions.pose (line 14)? In line 15 it look like you try to instantiate a pose object from it?
4th Sep 2021, 8:00 PM
Lisa
Lisa - avatar
+ 2
Is that the complete error message? No line number or further information?
4th Sep 2021, 7:46 PM
Simon Sauter
Simon Sauter - avatar
+ 2
It shows that I am new to the questions XD sorry for the problems that I have caused but I did not know how to solve this error that appeared to me
4th Sep 2021, 7:53 PM
Jcrex
Jcrex - avatar
+ 2
You need to specify all the parameters in the self.mpPose.Pose like this self.pose = self.mpPose.Pose(static_image_mode=self.static_image_mode, model_complexity=self.model_complexity, smooth_landmarks=self.smooth_landmarks, min_detection_confidence=self.min_detection_confidence, min_tracking_confidence=self.min_tracking_confidence)
7th Sep 2021, 7:09 PM
Sơn Tùng
Sơn Tùng - avatar
0
Thanks. It's much more readable this way. Unfortunately I can't run it because of missing modules. What's the error message you get?
4th Sep 2021, 7:32 PM
Simon Sauter
Simon Sauter - avatar
0
First of all, I can't find where to modify the post on pc, you could tell me where it is for future threads not to repeat. Now I explain the error calmly, I use the direct python idl to execute this code or also by system symbol, and when executing it, it indicates the following error: TypeError: create_bool (): incompatible function arguments. The following argument types are supported: 1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet But I know the code is fine but I can't get it to run that's why I've come here to the community to ask if anyone knows this type of code
4th Sep 2021, 7:41 PM
Jcrex
Jcrex - avatar
0
To help them execute this code, you need to have opencv and mediapipe, which are two packages that are used for this type of program.
4th Sep 2021, 7:43 PM
Jcrex
Jcrex - avatar
0
This is all that comes out but what it indicates is fine since I have reviewed it so I do not know what it may be because the lines of code indicated are correct File "C:\Users\juanc\Desktop\Computer Vision\PoseEstimationProject\PoseModulePrueba.py", line 79, in <module> main() File "C:\Users\juanc\Desktop\Computer Vision\PoseEstimationProject\PoseModulePrueba.py", line 63, in main detector = poseDetector() File "C:\Users\juanc\Desktop\Computer Vision\PoseEstimationProject\PoseModulePrueba.py", line 15, in __init__ self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth, File "C:\Users\juanc\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solutions\pose.py", line 146, in __init__ super().__init__( File "C:\Users\juanc\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 258, in __init__ self._input_side_packets = { File "C:\Users\juanc\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 259, in <dictcomp> name: self._make_packet(self._side_input_type_info[name], data) File "C:\Users\juanc\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 513, in _make_packet return getattr(packet_creator, 'create_' + packet_data_type.value)(data) TypeError: create_bool(): incompatible function arguments. The following argument types are supported: 1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet
4th Sep 2021, 7:51 PM
Jcrex
Jcrex - avatar
0
In line 15 there seems to be a line break in the middle of a statement. Right after "self.smooth". Remove that line break and try if that makes any difference.
4th Sep 2021, 7:57 PM
Simon Sauter
Simon Sauter - avatar
0
I already checked line 15 just in case and there is no problem on the line, it is as it should be 😭
4th Sep 2021, 8:00 PM
Jcrex
Jcrex - avatar
0
Did you make sure that there is no linebreak there in the original code?
4th Sep 2021, 8:01 PM
Simon Sauter
Simon Sauter - avatar
0
This is the original code I put it in my codes https://code.sololearn.com/c50bz3J2emQ6 and on the page where this comes from https://www.computervision.zone/topic/posemodule-py/ PoseModule.py
4th Sep 2021, 8:09 PM
Jcrex
Jcrex - avatar
0
It has the same line break. Only the line number is different here: 17. self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth, self.detectionCon, self.trackCon)
4th Sep 2021, 8:12 PM
Simon Sauter
Simon Sauter - avatar
0
I did not understand that part that says about line 17 and if the code is one line below the original it is because in the original code at the beginning I put its author
4th Sep 2021, 8:22 PM
Jcrex
Jcrex - avatar
0
There is a line break (a new line) in the middle of a statement. Make sure the statement is on one line and see if that resolves the issue.
4th Sep 2021, 8:27 PM
Simon Sauter
Simon Sauter - avatar
0
I've already done it and ran it but it keeps giving me the same error
4th Sep 2021, 8:34 PM
Jcrex
Jcrex - avatar
0
That's the only thing I could find. If that wasn't the problem it appears to be something related to the mediapipe module. Unfortunately I am completely unfamiliar with it and can't be of any help there.
4th Sep 2021, 8:39 PM
Simon Sauter
Simon Sauter - avatar
0
very good anyway you tried hard to help me thanks simon
4th Sep 2021, 8:42 PM
Jcrex
Jcrex - avatar