Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2797

Python project run inside NB raising exception while not in command line

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Invalid
    • 8.2, 11.0
    • None
    • None
    • Windows, NB11.0, NB8.2

    Description

      If I run a python script, exception is occurring only in NB. If I execute the same script with same python interpreter on command line, no exception is raised.

      Created sample project "sample_1" with a python test source file. After running the project NB output window showing below error:

      Traceback (most recent call last):
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 2320, in read_nonblocking
      s = self.readConsoleToCursor()
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 2226, in readConsoleToCursor
      if not self.__consout:
      AttributeError: 'Wtty' object has no attribute '_Wtty__consout'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 1414, in expect_loop
      c = self.read_nonblocking(self.maxread, timeout)
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 1790, in read_nonblocking
      s = self.wtty.read_nonblocking(timeout, size)
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 2341, in read_nonblocking
      raise EOF('End Of File (EOF) in Wtty.read_nonblocking().')
      wexpect.EOF: End Of File (EOF) in Wtty.read_nonblocking().
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
      File "C:\Users\Srinivag\Documents\NetBeansProjects\sample_1\src\wexpect_test.py", line 21, in <module>
      main()
      File "C:\Users\Srinivag\Documents\NetBeansProjects\sample_1\src\wexpect_test.py", line 16, in main
      child.expect('Enter your user-id/password and clearance level:')
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 1347, in expect
      return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 1361, in expect_list
      return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize)
      File "C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\lib\site-packages\wexpect.py", line 1432, in expect_loop
      raise EOF (str(e) + '\n' + str(self))
      wexpect.EOF: End Of File (EOF) in Wtty.read_nonblocking().
      <wexpect.spawn_windows object at 0x00000184A8499358>
      version: 0.0.1.unkown0 ($Revision: 399 $)
      command: C:\WINDOWS\system32\telnet.EXE
      args: ['C:\\WINDOWS\\system32\\telnet.EXE', '10.61.252.10']
      searcher: searcher_re:
      0: re.compile("Enter your user-id/password and clearance level:")
      buffer (last 100 chars):
      before (last 100 chars):
      after: <class 'wexpect.EOF'>
      match: None
      match_index: None
      exitstatus: None
      flag_eof: False
      pid: 2460
      child_fd: None
      closed: False
      timeout: 30
      delimiter: <class 'wexpect.EOF'>
      logfile: None
      logfile_read: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'>
      logfile_send: None
      maxread: 2000
      ignorecase: False
      searchwindowsize: None
      delaybeforesend: 0.05
      delayafterclose: 0.1
      delayafterterminate: 0.1
      

      The code sample_1:wexpect_test.py is as below:

      # To change this license header, choose License Headers in Project Properties.
      # To change this template file, choose Tools | Templates
      # and open the template in the editor.
      
      __author__ = "SrinivaG"
      __date__ = "$Jul 3, 2019 11:19:06 AM$"
      
      import sys
      import wexpect
      
      def main():
      child = wexpect.spawn('telnet 10.61.252.10')
      child.logfile_read = sys.stdout
      child.expect('Enter your user-id/password and clearance level:')
      child.sendline("gururaj/gjois1234")
      
      
      if __name__ == "__main__":
      main()
      

      If I execute same file in Windows command line, no exception occurs:

      PS C:\Users\Srinivag> C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\python.exe C:\Users\Srinivag\Documents\NetBeansProjects\sample_1\src\wexpect_test.py
      Enter your user-id/password and clearance level: >
      PS C:\Users\Srinivag>
      

      Python path configured in Tools->Python Platforms->"C:\Users\Srinivag\AppData\Local\Programs\Python\Python37\python.exe"

      Reproducible in both NB8.2 and NB11.0

      Installed below plugin for python project:

      http://plugins.netbeans.org/plugin/61688/python

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            gjois Gururaj
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: