PermissionError: [Errno 13] Permission denied: '/var/www/html/r/req/d'

Crash Report
============

This crash report was reported through the automatic crash reporting system 🤖

Traceback
--------------

```Python traceback
  File "/home/user/wspace/electrum/gui/qt/main_window.py", line 907, in save_payment_request
    self.wallet.add_payment_request(req, self.config)
  File "/home/user/wspace/electrum/lib/wallet.py", line 1563, in add_payment_request
    os.makedirs(path)
  File "/usr/lib/python3.5/os.py", line 231, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.5/os.py", line 231, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)

PermissionError: [Errno 13] Permission denied: '/var/www/html/r/req/d'
```

Reporter
------------

This issue was reported by 1 user(s):

| Electrum Version  | Operating System  | Wallet Type  | Locale |
|---|---|---|---|
| 3.1  | Linux-4.9.0-3-amd64-x86_64-with-debian-9.3 | standard | en_GB |


Additional Information
------------------------

The reporting user(s) did not provide additional information.
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
index 480d67fa5..ddaafc4b7 100644
--- a/gui/qt/main_window.py
+++ b/gui/qt/main_window.py
@@ -904,11 +904,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
         i = self.expires_combo.currentIndex()
         expiration = list(map(lambda x: x[1], expiration_values))[i]
         req = self.wallet.make_payment_request(addr, amount, message, expiration)
-        self.wallet.add_payment_request(req, self.config)
-        self.sign_payment_request(addr)
-        self.request_list.update()
-        self.address_list.update()
-        self.save_request_button.setEnabled(False)
+        try:
+            self.wallet.add_payment_request(req, self.config)
+        except Exception as e:
+            traceback.print_exc(file=sys.stderr)
+            self.show_error(_('Error adding payment request') + ':\\n' + str(e))
+        else:
+            self.sign_payment_request(addr)
+            self.save_request_button.setEnabled(False)
+        finally:
+            self.request_list.update()
+            self.address_list.update()
 
     def view_and_paste(self, title, msg, data):
         dialog = WindowModalDialog(self, title)
['gui/qt/main_window.py']