ASK for help: cannot upload my program to my board

Basic information: Win10x64, VScode,

, Arduino Uno.
When I try to upload my program to my Arduino Uno(it’s fine when compiling). It failed and give :

Tool Manager: Installing platformio/tool-avrdude @ ~1.60300.0
Error: Traceback (most recent call last):
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke     
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\commands\run\command.py", line 133, in cli    
    process_env(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\commands\run\command.py", line 175, in process_env
    result = {"env": name, "duration": time(), "succeeded": ep.process()}
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\commands\run\processor.py", line 79, in process
    result = p.run(build_vars, build_targets, self.silent, self.verbose, self.jobs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\platform\_run.py", line 60, in run
    self.autoinstall_runtime_packages()
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\platform\_packages.py", line 74, in autoinstall_runtime_packages
    self.pm.install(self.get_package_spec(name))
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\package\manager\_install.py", line 48, in install
    pkg = self._install(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\package\manager\_install.py", line 99, in _install
    pkg = self.install_from_registry(spec, search_filters, silent=silent)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\package\manager\_registry.py", line 83, in install_from_registry
    package = self.fetch_registry_package(spec)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\package\manager\_registry.py", line 144, in fetch_registry_package
    result = regclient.get_package(self.pkg_type, spec.owner, spec.name)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\clients\registry.py", line 136, in get_package
    return self.fetch_json_data(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\clients\http.py", line 144, in fetch_json_data
    response = self.send_request(method, path, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\util.py", line 73, in wrapper
    return func(*args, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\clients\http.py", line 123, in send_request   
    return getattr(self._session, method)(path, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\platformio\clients\http.py", line 61, in request
    return super(EndpointSession, self).request(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy  
    conn.connect()
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\connection.py", line 500, in _connect_tls_proxy  
    return ssl_wrap_socket(
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket      
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\users\labourerlu\.platformio\penv\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "C:\Users\LabourerLu\.platformio\python3\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\LabourerLu\.platformio\python3\lib\ssl.py", line 997, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

终端进程“C:\Users\LabourerLu\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'”已终止,退出代码: 1。

终端将被任务重用,按任意键关闭。

> Executing task in folder TEST: C:\Users\LabourerLu\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing uno (platform: atmelavr; board: uno; framework: arduino)

What can I do to upload my program successfully?

Seems like either a bug in PlatformIO or the urllib3 library, maybe in conjunction with a set Proxy URL in the system settings. Also reported in here.

Can you do the following: Open a CLI and execute

C:\Users\LabourerLu\.platformio\python3\python.exe -m pip install urllib3==1.25.11

then retry building. Does it work now?

Edit: Also see Change between 1.25.11 and 1.26.2 cause SSL issues for Proxy POST · Issue #2075 · urllib3/urllib3 · GitHub, might have something to do with proxy HTTP and HTTPS configuration.

1 Like

Please check this docs PlatformIO IDE for VSCode — PlatformIO latest documentation

After excuting

C:\Users\LabourerLu\.platformio\python3\python.exe -m pip install urllib3==1.25.11

my CLI returns that :

Could not fetch URL https://pypi.org/simple/urllib3/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/urllib3/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))) - skipping
ERROR: Could not find a version that satisfies the requirement urllib3==1.25.11
ERROR: No matching distribution found for urllib3==1.25.11
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))) - skipping

And when I try to upload, it still doesn’t work.

Then it’s very likely the SSL proxy settings that’s the problem.Follow Ivan’s link above.

I set my proxy setings like this:

{
    "C_Cpp.updateChannel": "Insiders",
    "explorer.confirmDelete": false,
    "http.proxySupport": "on",
    "window.zoomLevel": 1,
    "http.proxy": "http://user:pass@10.10.1.10:3128/",
    "http.proxyStrictSSL": false,
    "http.proxyAuthorization": null
}

but it still doesn’t work.(can not upload)

I wonder if I reinstall my VS code and platformIO works.

You copied this directly from the documentation? You need to supply the correct user, password, IP and port of the proxy of your network here for it to work. You are in a network that has a proxy, yes?

While the funny thing is that after I reinstalling my VS code, it works.