#๐ opencv error for loading image
76 messages ยท Page 1 of 1 (latest)
@vagrant sedge
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
self.icon = cv2.imread("paddle.png") / 255.0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
and yeah, when running through .ipynb it works
and for .py I have to remove .0
cv2 trying to read paddle.png but returned None
but that file is there
environment.py paddle.png __pycache__
look this is all files
hey , but I am on docker right now
The error didn't say its missing
The error is saying that can't divide None and 255.0
[ WARN:[email protected]] global loadsave.cpp:241 findDecoder imread_('paddle.png'): can't open/read file: check file path/integrity
this is full error
Maybe it needs the absolute path. Do you know where the file is stored?
home/user/Projects/Pong/RL/paddle.png
Didn't you say that its in the Docker container?
yeah, running on vs code
So where is the file at in Docker volume?
how to find?
I am new to this
you know I was asking about yestarday!
I am just using docker because of pytorch
so I pulll pytorch image in my Pong/
I forget. So is the paddle.png in Docker or not?
how to check?
Did you make a Dockerfile?
yeah
Show whats in it
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python"]```
yeah so the paddle.png is in /app
yeah sort of
wdym sort of?
ignore that
/app/RL/paddle.png
again same error
self.icon = cv2.imread("app/RL/paddle.png") / 255.0
I tried with RL/paddle.png also
same error again
Traceback (most recent call last):
File "/app/RL/environment.py", line 243, in <module>
obs = env.reset()
File "/app/RL/environment.py", line 131, in reset
self.striker = Striker()
File "/app/RL/environment.py", line 31, in __init__
self.icon = cv2.imread("/RL/paddle.png") / 255.0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'```
There's no /app in your imread
I tried and same error
Show it please
Traceback (most recent call last):
File "/app/RL/environment.py", line 243, in <module>
obs = env.reset()
File "/app/RL/environment.py", line 131, in reset
self.striker = Striker()
File "/app/RL/environment.py", line 31, in __init__
self.icon = cv2.imread("app/RL/paddle.png") / 255.0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'```
It needs the full absolute path
cv2.imread('/app/RL/paddle.png')
Traceback (most recent call last):
File "/app/RL/environment.py", line 243, in <module>
obs = env.reset()
File "/app/RL/environment.py", line 132, in reset
self.ball = Ball()
File "/app/RL/environment.py", line 67, in __init__
self.icon = cv2.imread("ball.png") / 255.0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'```
If it errors that as well, I need to see it pls
That's a different file
ohh that's mean it;s working
So that means the paddle.png works
lemmme do that for ball.png
Make sure its the absolute file path for all
yeah thanks for the time buddy!
I did app/...
but forgot to add / before app
close
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.