C-c RET py-execute-import-or-reload error

Bug #1478893 reported by chinatimwu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

1. create a new .py file, e.g. a1.py
2. input a line of code, e.g. print "abc"
3. C-c RET

then, get the following error in *Backtrace*

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  (string-match "python2" (file-name-nondirectory shell))
  (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))
  (let ((m (py--qualified-module-name (expand-file-name file)))) (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m)))
  (if (string-match "\\.py$" file) (let ((m (py--qualified-module-name (expand-file-name file)))) (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))) (py-which-execute-file-command file))
  (py--execute-file-base proc file (if (string-match "\\.py$" file) (let ((m (py--qualified-module-name (expand-file-name file)))) (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))) (py-which-execute-file-command file)))
  (let ((proc (or (condition-case nil (progn (get-process (file-name-directory shell))) (error nil)) (get-buffer-process (py-shell argprompt py-dedicated-process-p shell (or shell (default-value ...))))))) (save-some-buffers (not py-ask-about-save) nil) (py--execute-file-base proc file (if (string-match "\\.py$" file) (let ((m (py--qualified-module-name (expand-file-name file)))) (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))) (py-which-execute-file-command file))))
  (if file (let ((proc (or (condition-case nil (progn (get-process ...)) (error nil)) (get-buffer-process (py-shell argprompt py-dedicated-process-p shell (or shell ...)))))) (save-some-buffers (not py-ask-about-save) nil) (py--execute-file-base proc file (if (string-match "\\.py$" file) (let ((m (py--qualified-module-name ...))) (if (string-match "python2" (file-name-nondirectory shell)) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))) (py-which-execute-file-command file)))) (py-execute-buffer))
  (let ((py-shell-name (or shell (py-choose-shell argprompt shell))) (file (buffer-file-name (current-buffer)))) (if file (let ((proc (or (condition-case nil (progn ...) (error nil)) (get-buffer-process (py-shell argprompt py-dedicated-process-p shell ...))))) (save-some-buffers (not py-ask-about-save) nil) (py--execute-file-base proc file (if (string-match "\\.py$" file) (let ((m ...)) (if (string-match "python2" ...) (format "import sys\nif sys.modules.has_key('%s'):\n reload(%s)\nelse:\n import %s\n" m m m) (format "import sys,imp\nif'%s' in sys.modules:\n imp.reload(%s)\nelse:\n import %s\n" m m m))) (py-which-execute-file-command file)))) (py-execute-buffer)))
  py-execute-import-or-reload(1)
  #<subr call-interactively>(py-execute-import-or-reload nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> py-execute-import-or-reload nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (py-execute-import-or-reload nil nil))
  call-interactively(py-execute-import-or-reload nil nil)
  command-execute(py-execute-import-or-reload)

Changed in python-mode:
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.2.1
Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.