| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bb5c03e commit 935c849
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1915,7 +1915,12 @@ def main_curses(scr, args, config, interactive=True, locals_=None, | |||
| 1915 | 1915 | return (exit_value, clirepl.getstdout()) | |
| 1916 | 1916 | else: | |
| 1917 | 1917 | sys.path.insert(0, '') | |
| 1918 | - clirepl.startup() | ||
| 1918 | + try: | ||
| 1919 | + clirepl.startup() | ||
| 1920 | + except OSError as e: | ||
| 1921 | + # Handle this with a proper error message. | ||
| 1922 | + if e.errno != errno.ENOENT: | ||
| 1923 | + raise | ||
| 1919 | 1924 | ||
| 1920 | 1925 | if banner is not None: | |
| 1921 | 1926 | clirepl.write(banner) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -409,20 +409,6 @@ def sigtstp_handler(self, signum, frame): | |||
| 409 | 409 | self.after_suspend() | |
| 410 | 410 | self.__enter__() | |
| 411 | 411 | ||
| 412 | - def run_startup(self): | ||
| 413 | - """ | ||
| 414 | - Execute PYTHONSTARTUP file if it exits. Call this after front | ||
| 415 | - end-specific initialisation. | ||
| 416 | - """ | ||
| 417 | - filename = os.environ.get('PYTHONSTARTUP') | ||
| 418 | - if filename: | ||
| 419 | - with open(filename, 'r') as f: | ||
| 420 | - if py3: | ||
| 421 | - #TODO runsource has a new signature in PY3 | ||
| 422 | - self.interp.runsource(f.read(), filename, 'exec') | ||
| 423 | - else: | ||
| 424 | - self.interp.runsource(f.read(), filename, 'exec') | ||
| 425 | - | ||
| 426 | 412 | def clean_up_current_line_for_exit(self): | |
| 427 | 413 | """Called when trying to exit to prep for final paint""" | |
| 428 | 414 | logger.debug('unhighlighting paren for exit') | |
@@ -475,9 +461,10 @@ def process_control_event(self, e): | |||
| 475 | 461 | ||
| 476 | 462 | elif isinstance(e, bpythonevents.RunStartupFileEvent): | |
| 477 | 463 | try: | |
| 478 | - self.run_startup() | ||
| 464 | + self.startup() | ||
| 479 | 465 | except IOError as e: | |
| 480 | - self.status_bar.message(_('Executing PYTHONSTARTUP failed: %s') % (str(e))) | ||
| 466 | + self.status_bar.message( | ||
| 467 | + _('Executing PYTHONSTARTUP failed: %s') % (str(e))) | ||
| 481 | 468 | ||
| 482 | 469 | elif isinstance(e, bpythonevents.UndoEvent): | |
| 483 | 470 | self.undo(n=e.n) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ | |||
| 19 | 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | 21 | # THE SOFTWARE. | |
| 22 | - # | ||
| 23 | 22 | ||
| 24 | 23 | from __future__ import with_statement | |
| 25 | 24 | import code | |
@@ -406,7 +405,7 @@ def startup(self): | |||
| 406 | 405 | end-specific initialisation. | |
| 407 | 406 | """ | |
| 408 | 407 | filename = os.environ.get('PYTHONSTARTUP') | |
| 409 | - if filename and os.path.isfile(filename): | ||
| 408 | + if filename: | ||
| 410 | 409 | with open(filename, 'r') as f: | |
| 411 | 410 | if py3: | |
| 412 | 411 | self.interp.runsource(f.read(), filename, 'exec') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments