[Eric] Re: eric 4.1.1 interactive python console problem

Detlev Offenbach detlev at die-offenbachs.de
Mon Apr 14 18:51:19 BST 2008


On Montag, 14. April 2008, Melissa wrote:
> Detlev Offenbach <detlev at ...> writes:
> > can you please check, if the IDE is listening on a port? Can you try to
> > start the debugger backend manually via the shell context menu
> > 'Start->Python' entry?
>
> As far as I can see (netstat -b) there is nothing listening on a port that
> appears related to Eric or Python. Do you know how it would be identified?
> Or which port it would use?
>
> Running from a console window the only error messages I see are related to
> it not finding some Qt translation files, which is fine because the default
> seems to be English, which is working for me.
>
> I manually executed DebugServer.py, if that's what you meant by the
> debugger backend. No error message or anything but the console window
> disappear before I could see what was going on. <grrr windows...> Perhaps
> tomorrow I can try to run the code piece by piece and see what's
> failing....
>
> In the meantime do you know any small tests I can do to isolate the
> problem?
>
> Here are the bits of code from the call stack where the exception occurred:
>
>
> Here is where the exception is thrown (see line marked "fails here"):
>
>
>     def connectDebugger(self,port,remoteAddress=None,redirect=1):
>         """
>         Public method to establish a session with the debugger.
>
>         It opens a network connection to the debugger, connects it to
> stdin, stdout and stderr and saves these file objects in case the
> application being debugged redirects them itself.
>
>         @param port the port number to connect to (int)
>         @param remoteAddress the network address of the debug server host
>                (string)
>         @param redirect flag indicating redirection of stdin, stdout and
> stderr (boolean)
>         """
>         sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
>         if remoteAddress is None:
>             sock.connect((DebugAddress,port)) # fails here
>         else:
>             sock.connect((remoteAddress,port))
>         sock.setblocking(0)
>
>         self.readstream = AsyncFile(sock,sys.stdin.mode,sys.stdin.name)
>         self.writestream = AsyncFile(sock,sys.stdout.mode,sys.stdout.name)
>         self.errorstream = AsyncFile(sock,sys.stderr.mode,sys.stderr.name)
>
>         if redirect:
>             sys.stdin = self.readstream
>             sys.stdout = self.writestream
>             sys.stderr = self.errorstream
>         self.redirect = redirect
>
>         # attach to the main thread here
>         self.attachThread(mainThread=1)
>
> This is called from (see line marked "fails here"):
>
>     def main(self):
>         """
>         Public method implementing the main method.
>         """
>         if '--' in sys.argv:
>             args = sys.argv[1:]
>             host = None
>             port = None
>             wd = ''
>             tracePython = 0
>             exceptions = 1
>             redirect = 1
>             while args[0]:
>                 if args[0] == '-h':
>                     host = args[1]
>                     del args[0]
>                     del args[0]
>                 elif args[0] == '-p':
>                     port = args[1]
>                     del args[0]
>                     del args[0]
>                 elif args[0] == '-w':
>                     wd = args[1]
>                     del args[0]
>                     del args[0]
>                 elif args[0] == '-t':
>                     tracePython = 1
>                     del args[0]
>                 elif args[0] == '-e':
>                     exceptions = 0
>                     del args[0]
>                 elif args[0] == '-n':
>                     redirect = 0
>                     del args[0]
>                 elif args[0] == '--no-encoding':
>                     self.noencoding = True
>                     del args[0]
>                 elif args[0] == '--':
>                     del args[0]
>                     break
>                 else:   # unknown option
>                     del args[0]
>             if not args:
>                 print "No program given. Aborting!"
>             else:
>                 if not self.noencoding:
>                     self.__coding = self.defaultCoding
> ##                    try:
> ##                        sys.setappdefaultencoding(self.defaultCoding)
> ##                    except AttributeError:
> ##                        pass
>                 self.startProgInDebugger(args, wd, host, port,
>                                          exceptions=exceptions,
> tracePython=tracePython,
>                                          redirect=redirect)
>         else:
>             if sys.argv[1] == '--no-encoding':
>                 self.noencoding = True
>                 del sys.argv[1]
>             if sys.argv[1] == '':
>                 del sys.argv[1]
>             try:
>                 port = long(sys.argv[1])
>             except:
>                 port = -1
>             try:
>                 redirect = int(sys.argv[2])
>             except:
>                 redirect = 1
>             try:
>                 remoteAddress = sys.argv[3]
>             except:
>                 remoteAddress = None
>             sys.argv = ['']
>             if not '' in sys.path:
>                 sys.path.insert(0, '')
>             if port >= 0:
>                 if not self.noencoding:
>                     self.__coding = self.defaultCoding
> ##                    try:
> ##                        sys.setappdefaultencoding(self.defaultCoding)
> ##                    except AttributeError:
> ##                        pass
>                 self.connectDebugger(port, remoteAddress, redirect) # fails
> here self.__interact()
>             else:
>                 print "No network port given. Aborting..."
>
> This is called from the marked line below:
>
> # We are normally called by the debugger to execute directly.
>
> if __name__ == '__main__':
>     debugClient = DebugClientThreads()
>     debugClient.main() # failed here
>
> This is the error message in the eric error log file:
>
> ---------------------------------------------------------------------------
>---- 2008-04-13, 23:19:00
> ---------------------------------------------------------------------------
>----- exceptions.AttributeError:
> 'NoneType' object has no attribute 'remoteStatement'
> ---------------------------------------------------------------------------
>----- File
> "C:\apps\Python\Lib\site-packages\eric4\ViewManager\ViewManager.py", line
> 4308, in __editorCommand
>     e4App().getObject("Shell").editorCommand(cmd)
>   File "C:\apps\Python\Lib\site-packages\eric4\QScintilla\Shell.py", line
> 613, in editorCommand
>     self.supportedEditorCommands[cmd](cmd)
>   File "C:\apps\Python\Lib\site-packages\eric4\QScintilla\Shell.py", line
> 761, in __QScintillaNewline
>     self.__executeCommand(buf)
>   File "C:\apps\Python\Lib\site-packages\eric4\QScintilla\Shell.py", line
> 1007, in __executeCommand
>     self.dbs.remoteStatement(cmd)
>   File "C:\apps\Python\Lib\site-packages\eric4\Debugger\DebugServer.py",
> line 690, in remoteStatement
>     self.debuggerInterface.remoteStatement(stmt)

And this is the strange thing. self.debuggerInterface should not be None and I 
cannot find the path through the code, which could lead to such a problem. 
Maybe I am too blind to see it.

Detlev

>
> ---------------------------------------------------------------------------
>----- Version Numbers:
>   Python 2.4.5
>   Qt 4.3.3
>   PyQt4 4.3.3
>   sip 4.7.4
>   QScintilla 2.2
>   eric4 4.1.2 (r2105)
>
> Platform: win32
> 2.4.5 (#71, Mar 26 2008, 17:55:58) [MSC v.1310 32 bit (Intel)]
>
>
> Thanks.
>
> Melissa
>
> _______________________________________________
> Eric mailing list
> Eric at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/eric



-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list