GeezerVison is showing github.com — 'NoneType' object has no attribute 'strip' · Issue #7210 · pgadmin-org/pgadmin4
'NoneType' object has no attribute 'strip' #7210DescriptionDescribe the bug
When doing anything to a table or a view (and possibly other objects) using the "properties" right click menu, such as adding a column, there is a high chance of an error message of "'NoneType' object has no attribute 'strip'"
To Reproduce
Steps to reproduce the behavior:
- Go to any table
- Right click on table name, go to "Properties..."
- Add a column, or make any other change
- See the error
Expected behavior
Error should not show. Window should close and the work be completed.
Error message
'NoneType' object has no attribute 'strip'
This appears in a red box at the bottom of the window.
Desktop (please complete the following information):
- OS: Windows
- Version: 8.3, however this has been an issue for years.
- Mode: Desktop
- Package type: MSI installer
Additional context
This is extremely difficult to track down what triggers this bug. Sometimes it works. Sometimes it does not work. I have no reason for when it works and when it doesn't work. If I go to the SQL tab in the properties window, it produces perfect SQL every time, so I can just copy and paste that and it works fine, but clicking "Save" just doesn't work sometimes. Reacted by Rafi, Toby Dimmick and cobolbaby Activityadityatoshniwal commented on Feb 14, 2024 Hi @rbrooklyn,
Can you please share the pgAdmin logs from File->Runtime->View logs? rbrooklyn commented on Feb 14, 2024 rbrooklyn commented on Feb 16, 2024 Full log below from this morning. I started pgadmin this morning and tried to give a group access to a table and it failed. This is literally the only operation done with pgadmin and I'm happy to share the full log in this case:
pgAdmin Runtime Environment
Python Path: "C:\Program Files\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\RBrooklyn\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\pgAdmin 4\python\python.exe -s C:\Program Files\pgAdmin 4\web\pgAdmin4.py"
Environment:
- ALLUSERSPROFILE: C:\ProgramData
- APPDATA: C:\Users\RBrooklyn\AppData\Roaming
- CHROME_CRASHPAD_PIPE_NAME: \.\pipe\crashpad_12520_GOYQGZKPRFKOGSBK
- CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
- CommonProgramFiles: C:\Program Files\Common Files
- CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
- CommonProgramW6432: C:\Program Files\Common Files
- COMPUTERNAME: L219555
- ComSpec: C:\Windows\system32\cmd.exe
- DriverData: C:\Windows\System32\Drivers\DriverData
- FPS_BROWSER_APP_PROFILE_STRING: Internet Explorer
- FPS_BROWSER_USER_PROFILE_STRING: Default
- HOMEDRIVE: C:
- HOMEPATH: \Users\RBrooklyn
- JAVA_HOME: C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot\
- LOCALAPPDATA: C:\Users\RBrooklyn\AppData\Local
- LOGONSERVER: \L219555
- NUMBER_OF_PROCESSORS: 8
- OneDrive: C:\Users\RBrooklyn\OneDrive - Holland & Barrett
- OneDriveCommercial: C:\Users\RBrooklyn\OneDrive - Holland & Barrett
- OS: Windows_NT
- Path: C:\Program Files\pgAdmin 4\runtime;C:\Program Files\Python311\Scripts;C:\Program Files\Python311;C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\nodejs;C:\Users\RBrooklyn\AppData\Local\Microsoft\WindowsApps;C:\Users\RBrooklyn\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\PostgreSQL\15\bin;C:\Users\RBrooklyn\AppData\Roaming\npm
- PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
- PGADMIN_INT_KEY: cebc4e2e-04b1-49e2-9e8c-756ac0c13aea
- PGADMIN_INT_PORT: 50596
- PGADMIN_SERVER_MODE: OFF
- PROCESSOR_ARCHITECTURE: AMD64
- PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
- PROCESSOR_LEVEL: 6
- PROCESSOR_REVISION: 8c01
- ProgramData: C:\ProgramData
- ProgramFiles: C:\Program Files
- ProgramFiles(x86): C:\Program Files (x86)
- ProgramW6432: C:\Program Files
- PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
- PUBLIC: C:\Users\Public
- SESSIONNAME: Console
- SNOW_AGENT: C:\Program Files\Snow Software\Inventory\Agent\
- SystemDrive: C:
- SystemRoot: C:\Windows
- TEMP: C:\Users\RBROOK~1\AppData\Local\Temp
- TMP: C:\Users\RBROOK~1\AppData\Local\Temp
- USERDNSDOMAIN: corp.hollandandbarrett.net
- USERDOMAIN: CORP
- USERDOMAIN_ROAMINGPROFILE: CORP
- USERNAME: RBrooklyn
- USERPROFILE: C:\Users\RBrooklyn
- windir: C:\Windows
- ZES_ENABLE_SYSMAN: 1
Total spawn time to start the pgAdmin4 server: 0.018 Sec
2024-02-16 09:20:57,196: WARNING werkzeug: Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead.
- Serving Flask app 'pgadmin'
- Debug mode: off
Total time taken to ping pgAdmin4 server: 21.527 Sec
Total launch time of pgAdmin4: 22.006 Sec
Application Server URL: http://127.0.0.1:50596/?key=cebc4e2e-04b1-49e2-9e8c-756ac0c13aea
--------------[UI error]---------------
AxiosError: Request failed with status code 500
at http://127.0.0.1:50596/static/js/generated/vendor.others.js?ver=80300:109:2210814
at XMLHttpRequest.d (http://127.0.0.1:50596/static/js/generated/vendor.others.js?ver=80300:109:2210959)
at ke.request (http://127.0.0.1:50596/static/js/generated/vendor.others.js?ver=80300:109:2216487)
------------[UI End]---------------- adityatoshniwal commented on Feb 19, 2024 @rbrooklyn Still not reproducible. Can you share exact permissions screenshot? We can try same. Or even you can try. rbrooklyn commented on Feb 19, 2024 It's not just permissions... It's anything using those windows. On these occasions it was permissions, but sometimes it's adding a column, or a constraint, or anything else.
For example, when writing this comment, I added a column called "farts" to this table and got the error:

Yet as you can see, valid SQL is produced:

I can try 10 times and it works 10 times. I can try 10 times and it fails 10 times (although if it fails I do have to close and reopen to window to have any chance of success). Sometimes I can close the window, do the exact same changes and press "Save" and it will work again. Which is exactly what happened here when I closed the window, did the exact same action, but this time it worked:

It's incredibly difficult to reproduce and this bug is years old but I've never reported it as I've never found what triggers it. This has, however, happened over multiple machines.
SELECT VERSION() returns:
PostgreSQL 13.13 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit adityatoshniwal commented on Feb 20, 2024 Hi @rbrooklyn,
Does it occur only on this table? If yes, then you can share the DDL of this table. rtrad89 commented on Feb 21, 2024 I am facing the same issue on Ubuntu with pgAdmin desktop 8.4. rbrooklyn commented on Feb 21, 2024
Hi @rbrooklyn, Does it occur only on this table? If yes, then you can share the DDL of this table.
No, it occurs everywhere.
Is there a way of turning on extra debugging? The logs I've sent don't look very helpful. adityatoshniwal commented on Feb 23, 2024 HI @rbrooklyn,
Can you replace the file attached on path /pgadmin install dir/web/pgadmin/browser/server_groups/servers/
databases/schemas/tables/init.py and then restart pgAdmin?
init.py.zip
Once you get the error share the logs. jonathan-knight commented on Mar 1, 2024 This has been a problem since around 7.2 or 7.3. Prior versions work fine.
The only extra info I can give is that if I make the change to the columns and then hit the "SQL" tab I can see the SQL that's about to be done.
If I hit save first and cause an error, the SQL tab only ever reports "Definition incomplete"
I haven't spotted the pattern of when it happens and when it doesn't. It's most of the time, but not all of the time and never on new small tables, just the big awkward ones. rbrooklyn commented on Mar 5, 2024 Hello,
I've been unable to trigger this bug for the past week. I have loaded in the python code given and once I trigger it I will update this issue with the log.
Just reassuring that I haven't forgotten about this. I'm keen to fix this. Reacted by Aditya Toshniwal rbrooklyn commented on Mar 8, 2024 I've managed to trigger the issue this morning when changing permissions for a table.
I have upgraded to 8.4 this morning before this was triggered, so please keep this in mind. In hindsight, that may have been a mistake, but I don't think the python file has been rewritten (or maybe it was still loaded somehow, I don't know) as there is more information this time.
Log is below:
2024-03-08 09:37:39,318: ERROR pgadmin: 'NoneType' object has no attribute 'strip'
Traceback (most recent call last):
File "C:\Program Files\pgAdmin 4\web\pgadmin\browser\server_groups\servers\databases\schemas\tables_init_.py", line 1074, in update
lock_on_table = self.get_table_locks(did, res['rows'][0])
File "C:\Program Files\pgAdmin 4\web\pgadmin\browser\server_groups\servers\databases\schemas\tables\utils.py", line 2058, in get_table_locks
if row['relation'].strip('"') == data['name']:
AttributeError: 'NoneType' object has no attribute 'strip'
--------------[UI error]---------------
AxiosError: Request failed with status code 500
at http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2196728
at XMLHttpRequest.f (http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2196873)
at ke.request (http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2202401)
------------[UI End]----------------
gmolop commented on Mar 26, 2024 +1 here.. same bug using gui (on v8.4 win)
as workarround, I run the query manually...
Ex. GRANT SELECT ON TABLE public.table_name TO user; and works
I've managed to trigger the issue this morning when changing permissions for a table.
I have upgraded to 8.4 this morning before this was triggered, so please keep this in mind. In hindsight, that may have been a mistake, but I don't think the python file has been rewritten (or maybe it was still loaded somehow, I don't know) as there is more information this time.
Log is below:
2024-03-08 09:37:39,318: ERROR pgadmin: 'NoneType' object has no attribute 'strip'
Traceback (most recent call last):
File "C:\Program Files\pgAdmin 4\web\pgadmin\browser\server_groups\servers\databases\schemas\tables__init__.py", line 1074, in update
lock_on_table = self.get_table_locks(did, res['rows'][0])
File "C:\Program Files\pgAdmin 4\web\pgadmin\browser\server_groups\servers\databases\schemas\tables\utils.py", line 2058, in get_table_locks
if row['relation'].strip('"') == data['name']:
AttributeError: 'NoneType' object has no attribute 'strip'
--------------[UI error]---------------
AxiosError: Request failed with status code 500
at http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2196728
at XMLHttpRequest.f (http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2196873)
at ke.request (http://127.0.0.1:51378/static/js/generated/vendor.others.js?ver=80400:109:2202401)
------------[UI End]----------------
anilsahoo20 commented on Apr 3, 2024 As per the errors in log, we have fixed this.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|