I just updated to Ubuntu 17.04 (and it's a great release; I was on 16.04 LTS before and it's well-worth the update) and noticed that I kept getting the above error when I tried to elevate my privs to edit system files with a graphical text editor (typically gedit, but I've switched to pluma). That's a result of improved security measures in Wayland that we didn't have to worry about with the now-abandoned Unity desktop used in previous releases.
Most of the solutions floating around for this error refer to X sessions (usually X-forwarding over SSH) and don't actually do anything to correct the Wayland issue. However, I came across this solution, which worked a treat:
Step 1.) Create a new local directory to house a custom executable:
mkdir ~/.local/bin/Step 2.) Next, we'll make a little script that will elevate the privileges for us when invoked (the OP called it 'wsudo', which seems like a good choice to me):
nano ~/.local/bin/wsudoStep 3.) Paste in these contents:
#!/bin/bashStep 4.) Make the script executable:
#small script to enable root access to x-windows systems
#disable root access after application terminates
#print access status to allow verification that root access was removed
chmod +x ~/.local/bin/wsudoStep 5.) Temporarily add our local script directory to our Path for easy access:
export PATH=$PATH:~/.local/binNow, you can take it for a spin and make sure it works as expected (by running, for example, wsudo gedit /testfile and making sure it saves okay). If everything is in order...
Step 6.) Permanently add our local script directory to our Path:
echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrcThat's it. Now you should be able to invoke wsudo any time you need to run a GUI program with elevated privs.