Use pdb if remote_pdb isn't installed
This commit is contained in:
		
							
								
								
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							@@ -1,6 +1,5 @@
 | 
				
			|||||||
# TODO
 | 
					# TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- pdb
 | 
					 | 
				
			||||||
- uplaod/download use kwargs
 | 
					- uplaod/download use kwargs
 | 
				
			||||||
- highlight messages being responded to
 | 
					- highlight messages being responded to
 | 
				
			||||||
- highlight messages with mention
 | 
					- highlight messages with mention
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -106,20 +106,32 @@ class QMLBridge:
 | 
				
			|||||||
        ba  = self.backend                 # noqa
 | 
					        ba  = self.backend                 # noqa
 | 
				
			||||||
        mo  = self.backend.models          # noqa
 | 
					        mo  = self.backend.models          # noqa
 | 
				
			||||||
        cl  = self.backend.clients
 | 
					        cl  = self.backend.clients
 | 
				
			||||||
        gcl = lambda user: cl[f"@{user}:matrix.org"]  # noqa
 | 
					        gcl = lambda user: cl[f"@{user}"]  # noqa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rc = lambda c: asyncio.run_coroutine_threadsafe(c, self._loop)  # noqa
 | 
					        rc = lambda c: asyncio.run_coroutine_threadsafe(c, self._loop)  # noqa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        p = print  # pdb's `p` doesn't print a class's __str__  # noqa
 | 
					        p = print  # pdb's `p` doesn't print a class's __str__  # noqa
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
 | 
					            log.warning("\nThe pprintpp python package is not installed.")
 | 
				
			||||||
            from pprintpp import pprint as pp  # noqa
 | 
					            from pprintpp import pprint as pp  # noqa
 | 
				
			||||||
        except ModuleNotFoundError:
 | 
					        except ModuleNotFoundError:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        log.info("\n=> Run `socat readline tcp:127.0.0.1:4444` in a terminal "
 | 
					        try:
 | 
				
			||||||
                 "to connect to pdb.")
 | 
					            import remote_pdb
 | 
				
			||||||
        import remote_pdb
 | 
					        except ModuleNotFoundError:
 | 
				
			||||||
        remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
 | 
					            log.warning(
 | 
				
			||||||
 | 
					                "\nThe remote_pdb python package is not installed, falling "
 | 
				
			||||||
 | 
					                "back to pdb.",
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            import pdb
 | 
				
			||||||
 | 
					            pdb.set_trace()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            log.info(
 | 
				
			||||||
 | 
					                "\n=> Run `socat readline tcp:127.0.0.1:4444` in a terminal "
 | 
				
			||||||
 | 
					                "to connect to the debugger.",
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The AppImage AppRun script overwrites some environment path variables to
 | 
					# The AppImage AppRun script overwrites some environment path variables to
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user