Print working, but can't connect to http://octopi.local/

The network adapters (wireless, wired) in an RPi are completely controlled by the operating system. OctoPrint and Python do not have any influence on the state of the adapters, only the drivers and utilities supplied with the operating system.

OctoPi is a repackaging of the lite version of the Raspberry Pi OS (Raspbian) with added packages like OctoPrint. I believe that since "the silent majority" of users aren't having a problem, OctoPi (both 0.17 and 0.18) contain the correct network drivers.

Of course, there could be an obscure bug that is showing itself in the cases reported here. I'd suggest checking the Raspberry Pi forums for similar reports and possible solutions.

Ok so you didn't migrate to Python 3, you just installed OctoPi. Not my problem then.

It's fully possible that the upstream RPi OS distro has this issue, but it's definitely not related to Python 3.

Sorry to necro post (not sure if 3d is necro) but if this is a common problem that you are experiencing with your Pi, and you have narrowed your search down the Pi being the issue rather than OctoPrint (which if you're on post is more than likely) then a quick fix can be to set a fixed local IP for your Pi's MAC address.

Should your Pi lose its wireless connection for whatever reason, then you don't need to worry about your home router giving it a new IP address and screwing with any cached DNS addresses. Just a quick and dirty fix, but if you're 3+ hours into a print, it at least lets you finish the print before fixing the underlying issue.

I'm supporting this resurrection! I've the same issue - Pi 4 unresponsive in middle of a 6 hour print, although print proceeding without issue. My router has also stopped showing the connection. I had already set up a static local ip for it and tried connecting via a mac as well as my usual Windows 10, without success. It is a new setup using latest updates, so I obviously can't comment on previous software but I may give @jaduret fix a try

Yes, the print still finished, but I could not control/connect to my printer

I haven't had the problem since I updated my printer firmware, so I'm not sure python had anything to do with it in my case?

Ubuntu 20.04.2 LTS

Ip was never an issue, even after running into the problem and I could not connect to Octoprint for the remainder of a print, after restarting the pi (and I then could connect) the IP was always the same.

What printer are you using? Which version of Marlin?

I know this is old, but... The way i found it was by opening CMD and doing a tracert from the IP.

tracert 192.168.1.xxx

From here it should show you what its URL is.