Thread: ValueError: unsupported format character 'D'

ValueError: unsupported format character 'D'

From
Sekretarka Rafala
Date:
Hello

I went through the installation description of pgAdmin on 

Installation was done on Centos8. 

After connecting to pgAdmin web site I got "server error" in browser and following messages in the error_log of Apache

Are you able to advise what can be done?

[Fri Nov 20 16:26:44.074222 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] mod_wsgi (pid=38774): Exception occurred processing WSGI script '/usr/lib/python3.6/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Fri Nov 20 16:26:44.077629 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] Traceback (most recent call last):
[Fri Nov 20 16:26:44.077673 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2309, in __call__
[Fri Nov 20 16:26:44.077677 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.wsgi_app(environ, start_response)
[Fri Nov 20 16:26:44.077682 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgAdmin4.py", line 72, in __call__
[Fri Nov 20 16:26:44.077684 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.app(environ, start_response)
[Fri Nov 20 16:26:44.077687 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/werkzeug/middleware/proxy_fix.py", line 228, in __call__
[Fri Nov 20 16:26:44.077690 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.app(environ, start_response)
[Fri Nov 20 16:26:44.077693 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2295, in wsgi_app
[Fri Nov 20 16:26:44.077695 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     response = self.handle_exception(e)
[Fri Nov 20 16:26:44.077698 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1741, in handle_exception
[Fri Nov 20 16:26:44.077700 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     reraise(exc_type, exc_value, tb)
[Fri Nov 20 16:26:44.077703 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/_compat.py", line 35, in reraise
[Fri Nov 20 16:26:44.077706 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     raise value
[Fri Nov 20 16:26:44.077709 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2292, in wsgi_app
[Fri Nov 20 16:26:44.077711 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     response = self.full_dispatch_request()
[Fri Nov 20 16:26:44.077714 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1808, in full_dispatch_request
[Fri Nov 20 16:26:44.077716 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     self.try_trigger_before_first_request_functions()
[Fri Nov 20 16:26:44.077719 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1855, in try_trigger_before_first_request_functions
[Fri Nov 20 16:26:44.077721 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     func()
[Fri Nov 20 16:26:44.077724 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/__init__.py", line 48, in create_module_preference
[Fri Nov 20 16:26:44.077727 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     self.register_preferences()
[Fri Nov 20 16:26:44.077730 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/__init__.py", line 272, in register_preferences
[Fri Nov 20 16:26:44.077732 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     register_browser_preferences(self)
[Fri Nov 20 16:26:44.077735 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/register_browser_preferences.py", line 461, in register_browser_preferences
[Fri Nov 20 16:26:44.077741 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     'Supported placeholders are %DATABASE%, %USERNAME%, and %SERVER%. '
[Fri Nov 20 16:26:44.077745 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask_babelex/__init__.py", line 623, in gettext
[Fri Nov 20 16:26:44.077747 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return get_domain().gettext(*args, **kwargs)
[Fri Nov 20 16:26:44.077750 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask_babelex/__init__.py", line 534, in gettext
[Fri Nov 20 16:26:44.077753 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return t.ugettext(string) % variables
[Fri Nov 20 16:26:44.077765 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] ValueError: unsupported format character 'D' (0x44) at index 28

Regards
Rafal

Re: ValueError: unsupported format character 'D'

From
George
Date:
Hello ,  I also encountered this issue while I staring the pgAdmin4 on
CentOS7.

Fixed it by changing "%" to "%%" in file
/pgadmin/browser/register_browser_preferences.py". 
It's python usage for processing a variable which has pre- and post- "%",
such as "%%DATABASE%%". 
you can try.

/[Fri Nov 20 16:26:44.077735 2020] [wsgi:error] [pid 38774:tid
139824286275328] [remote ::1:55110]   File
"/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/register_browser_preferences.py",
line 461, in register_browser_preferences
[Fri Nov 20 16:26:44.077741 2020] [wsgi:error] [pid 38774:tid
139824286275328] [remote ::1:55110]     'Supported placeholders are
%DATABASE%, %USERNAME%, and %SERVER%. '
/
====-----------------------
457         gettext("Query tool tab title"),
458         'text', '%DATABASE%/%USERNAME%@%SERVER%',
459         category_label=PREF_LABEL_DISPLAY,
460         help_str=gettext(
461             'Supported placeholders are %%DATABASE%%, %%USERNAME%%, and
%%SERVER%%. '
462             'Users can provide any string with or without placeholders
of'
463             ' their choice. The blank title will be revert back to the'
464             ' default title with placeholders.'
465         )
466     )
467
468     self.ve_edt_tab_title = self.preference.register(
469         'tab settings', 'vw_edt_tab_title_placeholder',
470         gettext("View/Edit data tab title"),
471         'text',
'%%SCHEMA%%.%%TABLE%%/%%DATABASE%%/%%USERNAME%%@%%SERVER%%',
472         category_label=PREF_LABEL_DISPLAY,
473         help_str=gettext(
474             'Supported placeholders are %%SCHEMA%%, %%TABLE%%,
%%DATABASE%%, '
475             '%%USERNAME%%, and %%SERVER%%. Users can provide any string
with or '
476             'without placeholders of their choice. The blank title will
be '
477             'revert back to the default title with placeholders.'
478         )
479     )
480
481     self.debugger_tab_title = self.preference.register(
482         'tab settings', 'debugger_tab_title_placeholder',
483         gettext("Debugger tab title"),
484         'text', '%%FUNCTION%%(%%ARGS%%)',
485         category_label=PREF_LABEL_DISPLAY,
486         help_str=gettext(
487             'Supported placeholders are %%FUNCTION%%, %%ARGS%%,
%%SCHEMA%% and'
488             ' %%DATABASE%%. Users can provide any string with or '
489             'without placeholders of their choice. The blank title will
be'
490             ' revert back to the default title with placeholders.'
491         )
492     )
493
494     self.open_in_new_tab = self.preference.register(
495         'tab settings', 'new_browser_tab_open',
496         gettext("Open in new browser tab"), 'select2', None,
497         category_label=PREF_LABEL_OPTIONS,
498         options=[{'label': gettext('Query Tool'), 'value': 'qt'},
499                  {'label': gettext('Debugger'), 'value': 'debugger'},




--
Sent from: https://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html



Re: ValueError: unsupported format character 'D'

From
Dave Page
Date:
Hi

On Fri, Nov 20, 2020 at 4:16 PM Sekretarka Rafala <sekretarka.rafala@gmail.com> wrote:
Hello

I went through the installation description of pgAdmin on 

Installation was done on Centos8. 

After connecting to pgAdmin web site I got "server error" in browser and following messages in the error_log of Apache

Are you able to advise what can be done?

I would strongly recommend using the packages the pgAdmin team produce, as they are quite different from the ones installed if you follow that web page. See https://www.pgadmin.org/download/pgadmin-4-rpm/

 

[Fri Nov 20 16:26:44.074222 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] mod_wsgi (pid=38774): Exception occurred processing WSGI script '/usr/lib/python3.6/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Fri Nov 20 16:26:44.077629 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] Traceback (most recent call last):
[Fri Nov 20 16:26:44.077673 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2309, in __call__
[Fri Nov 20 16:26:44.077677 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.wsgi_app(environ, start_response)
[Fri Nov 20 16:26:44.077682 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgAdmin4.py", line 72, in __call__
[Fri Nov 20 16:26:44.077684 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.app(environ, start_response)
[Fri Nov 20 16:26:44.077687 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/werkzeug/middleware/proxy_fix.py", line 228, in __call__
[Fri Nov 20 16:26:44.077690 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return self.app(environ, start_response)
[Fri Nov 20 16:26:44.077693 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2295, in wsgi_app
[Fri Nov 20 16:26:44.077695 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     response = self.handle_exception(e)
[Fri Nov 20 16:26:44.077698 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1741, in handle_exception
[Fri Nov 20 16:26:44.077700 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     reraise(exc_type, exc_value, tb)
[Fri Nov 20 16:26:44.077703 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/_compat.py", line 35, in reraise
[Fri Nov 20 16:26:44.077706 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     raise value
[Fri Nov 20 16:26:44.077709 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 2292, in wsgi_app
[Fri Nov 20 16:26:44.077711 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     response = self.full_dispatch_request()
[Fri Nov 20 16:26:44.077714 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1808, in full_dispatch_request
[Fri Nov 20 16:26:44.077716 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     self.try_trigger_before_first_request_functions()
[Fri Nov 20 16:26:44.077719 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask/app.py", line 1855, in try_trigger_before_first_request_functions
[Fri Nov 20 16:26:44.077721 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     func()
[Fri Nov 20 16:26:44.077724 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/__init__.py", line 48, in create_module_preference
[Fri Nov 20 16:26:44.077727 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     self.register_preferences()
[Fri Nov 20 16:26:44.077730 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/__init__.py", line 272, in register_preferences
[Fri Nov 20 16:26:44.077732 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     register_browser_preferences(self)
[Fri Nov 20 16:26:44.077735 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/register_browser_preferences.py", line 461, in register_browser_preferences
[Fri Nov 20 16:26:44.077741 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     'Supported placeholders are %DATABASE%, %USERNAME%, and %SERVER%. '
[Fri Nov 20 16:26:44.077745 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask_babelex/__init__.py", line 623, in gettext
[Fri Nov 20 16:26:44.077747 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return get_domain().gettext(*args, **kwargs)
[Fri Nov 20 16:26:44.077750 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]   File "/usr/lib/python3.6/site-packages/pgadmin4-web/flask_babelex/__init__.py", line 534, in gettext
[Fri Nov 20 16:26:44.077753 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110]     return t.ugettext(string) % variables
[Fri Nov 20 16:26:44.077765 2020] [wsgi:error] [pid 38774:tid 139824286275328] [remote ::1:55110] ValueError: unsupported format character 'D' (0x44) at index 28

Regards
Rafal


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: http://www.enterprisedb.com