0

I am using minio as follows (example):

minio_client = Minio(
endpoint="my.minio.com:10092",
access_key="minio",
secret_key="minio123!"
)

buckets = minio_client.list_buckets()
for bucket in buckets:
    print(bucket.name)

Debugging the code above with VSCode (Python 3.11 / Miniconda - a new environment with only minio installed) I get the following error:

File "C:\Path\to\Miniconda3\envs\minio\Lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='my.minio.com', port=10092): Max retries exceeded with url: / (Caused by SSLError(FileNotFoundError(2, 'No such file or directory')))

I have double checked address and credentials several times, the minio is accessible from other SDKs (I have a different application using the C# SDK) and the WebUI. Additionally if I run the program from the terminal with the same Miniconda environment activated, it works flawlessly. What could be the reason for this issue?

EDIT

Just tested the same code with PyCharm and there it works as well. So the issue definitely has something to do with VSCode. Additionally running the script in VSCode without the debugger works as well.

Roland Deschain
  • 2,211
  • 19
  • 50
  • How do you debug the code? Is it configured with [*launch.json*](https://code.visualstudio.com/docs/python/debugging#_set-configuration-options)? – JialeDu Apr 05 '23 at 06:08
  • @JialeDu Yes I normally do, but I have already tried to delete the launch.json and launch the python file directly with the same result. The underlying reason for this error is described in [my newer post](https://stackoverflow.com/questions/75926017/os-environssl-cert-file-stores-a-path-to-a-non-existing-file-in-visual-studi?noredirect=1&lq=1). If I can solve that issues, I think I will be able to solve this question here as well. – Roland Deschain Apr 05 '23 at 06:20
  • Why it tried connecting through `ssl`? I thought it should connect through pure `tcp`. – Horsing Apr 07 '23 at 14:17
  • @Horsing I'm not sure I understand, as far as I know Minio works via http request. If you don't set `secure=false` it uses a ssl. – Roland Deschain Apr 07 '23 at 14:35

1 Answers1

0

Configure SSL_CERT_FILE in Launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "env": {
                "SSL_CERT_FILE": ""
            },
        }
    ]
}
JialeDu
  • 6,021
  • 2
  • 5
  • 24