> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Andreas Roehler
> Sent: Sunday, April 08, 2012 2:00 PM
> To: Richard Stanton
> Subject: [Bug 975539] Re: Problem with py-separator-char under Windows
>
> made some related changes, please try again
>
> ** Changed in: python-mode
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/975539
>
> Title:
> Problem with py-separator-char under Windows
>
> Status in An Emacs mode for editing Python code:
> Fix Committed
>
> Bug description:
> Usiong r922, py-separator-char returns the following on my Windows
> machine:
>
> "/usr/bin/bash: -c: line 0: syntax error near unexpected token
> `os.sep'/usr/bin/bash: -c: line 0: `c:/python27/Scripts/ipython.bat -W
> ignore -c \\import os; print(os.sep)\\'"
>
> On my Mac, it returns "/", which seems more reasonable.
>
> NOTE: On a Windows machine I *strongly* recommend just hard-coding (or
> at least letting the user hard-code) the directory separator. Even if
> we could get the current code to work under Windows, it would return
> "\", and this would still lead to problems because Emacs under Windows
> likes to use the default Unix "/" separator, so it makes more sense to
> tell python-mode to use "/".
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/python-mode/+bug/975539/+subscriptions
R927 worked as long as I set py-separator-char to 47.
R928 doesn't work with either 47 or "/". I suspect this may be because with the new sepchar code in r928, sepchar ends up being set to "\"/\"".
With py-separator-char set to 47, here's what I get when I press C-c C-c to run my script under r928:
Debugger entered--Lisp error: (error "No buffer named *IPython*") "*IPython* ") windows- on-execute- p (or (eq switch (quote switch)) py-shell- switch- buffers- on-execute- p))) (unless (string-match "[Ii][Pp]ython" py-buffer-name) (delete- other-windows) ) (when (window- full-height- p) (funcall py-split- windows- on-execute- function) ) (pop-to-buffer py-buffer-name)) ((and py-split- windows- on-execute- p (or (eq switch (quote noswitch)) (not (eq switch (quote switch))))) (when (window- full-height- p) (funcall py-split- windows- on-execute- function) ) (set-buffer py-buffer-name) (switch-to-buffer (current-buffer)) (other-window 1)) ((or (eq switch (quote switch)) (and (not (eq switch (quote noswitch))) py-shell- switch- buffers- on-execute- p)) (pop-to-buffer py-buffer-name) (goto-char (point-max))) ((or (eq switch (quote noswitch)) (not py-shell- switch- buffers- on-execute- p)) (set-buffer oldbuf) (switch-to-buffer (current-buffer)))) manage- windows( nil t nil #<buffer run.py> "*IPython*") execute- delay)) (setq erg (py-execute- file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell- manage- windows switch py-split- windows- on-execute- p py-shell- switch- buffers- on-execute- p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute- keep-temporary- file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg) execute- delay)) (setq erg (py-execute- file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell- manage- windows switch py-split- windows- on-execute- p py-shell- switch- buffers- on-execute- p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute- keep-temporary- file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg) (message "%s not readable. %s" file "Do you have write permissions?")) directory (or (ignore-errors (file-name- directory (buffer- file-name) )) (getenv "WORKON_HOME") (getenv "HOME"))) (strg (buffer- substring- no-properties start end)) (sepchar (if sepchar (regexp-quote sepchar) (py-separator- char))) (name (py-buffer- name-prepare shell sepchar)) (temp (make-temp-name shell)) (file (concat (expand-file-name temp py-temp-directory) ".py")) (filebuf (get-buffer-create file)) (proc (if dedicated (get-buffer-process (py-shell nil dedicated (or shell (downcase shell)) switch sepchar name t)) (or (get-buffer-process shell) (get-buffer-process (py-shell nil dedicated (or shell ...) switch sepchar name t))))) (procbuf (if dedicated (buffer-name (get-buffer (current-buffer))) (py-process-name name dedicated nostars sepchar))) (pec (if (string-match "Python *3" name) (format "exec(compile( open('% s').read( ), '%s', 'exec')) # PYTHON-MODE\n" file file) (format "execfile(r'%s') # PYTHON-MODE\n" file))) (wholebuf (when (boundp (quote wholebuf)) wholebuf)) (comint- scroll- to-bottom- on-output t) erg) (set-buffer filebuf) (erase-buffer) (insert strg) (unless wholebuf (py-fix-start (point-min) (point-max)) (py-if- needed- insert- shell name) (py-insert-coding) (py-insert- execute- directory) ) (set-buffer filebuf) (write-region (point-min) (point-max) file nil t nil (quote ask)) (set-buffer- modified- p (quote nil)) (kill-buffer filebuf) (if (file-readable-p file) (progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython- execute- delay)) (setq erg (py-execute- file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell- manage- windows switch py-split- windows- on-execute- p py-shell- switch- buffers- on-execute- p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute- keep-temporary- file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg) (message "%s not readable. %s" file "Do you have write permissions?"))) numeric- value shell)) (default-value (quote py-shell-name))) ((and (numberp shell) (not (eq 1 ...))) (read-from- minibuffer "(path- to-)shell- name: " (default-value (quote py-shell-name)))) (t shell)))) (py-execute-base start end shell dedicated switch)) region( 1 21 nil nil nil) py-master- file))) beg end) (when py-master-file (let* ((filename (expand-file-name py-master-file)) (buffer (or (get-file-buffer filename) (find-file-noselect filename)))) (set-buffer buffer))) (setq beg (point-min)) (setq end (point-max)) (py-execute-region beg end shell dedicated switch)) py-master- file))) beg end) (when py-master-file (let* ((filename (expand-file-name py-master-file)) (buffer (or (get-file-buffer filename) (find-file-noselect filename)))) (set-buffer buffer))) (setq beg (point-min)) (setq end (point-max)) (py-execute-region beg end shell dedicated switch))) buffer( nil) interactively( py-execute- buffer nil nil)
set-buffer(
(cond ((unless (eq switch (quote noswitch)) (and py-split-
py-shell-
(progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython-
(if (file-readable-p file) (progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython-
(let* ((oldbuf (current-buffer)) (shell (or shell (py-choose-shell))) (regbuf (current-buffer)) (py-execute-
py-execute-base(1 21 nil nil nil)
(let ((shell (cond ((eq 4 (prefix-
py-execute-
(let ((wholebuf t) (py-master-file (or py-master-file (py-fetch-
(save-excursion (let ((wholebuf t) (py-master-file (or py-master-file (py-fetch-
py-execute-
call-
> -----Original Message----- /bugs.launchpad .net/bugs/ 975539 /usr/bin/ bash: -c: line 0: `c:/python27/ Scripts/ ipython. bat -W /bugs.launchpad .net/python- mode/+bug/ 975539/ +subscriptions
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Andreas Roehler
> Sent: Sunday, April 08, 2012 2:00 PM
> To: Richard Stanton
> Subject: [Bug 975539] Re: Problem with py-separator-char under Windows
>
> made some related changes, please try again
>
> ** Changed in: python-mode
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https:/
>
> Title:
> Problem with py-separator-char under Windows
>
> Status in An Emacs mode for editing Python code:
> Fix Committed
>
> Bug description:
> Usiong r922, py-separator-char returns the following on my Windows
> machine:
>
> "/usr/bin/bash: -c: line 0: syntax error near unexpected token
> `os.sep'
> ignore -c \\import os; print(os.sep)\\'"
>
> On my Mac, it returns "/", which seems more reasonable.
>
> NOTE: On a Windows machine I *strongly* recommend just hard-coding (or
> at least letting the user hard-code) the directory separator. Even if
> we could get the current code to work under Windows, it would return
> "\", and this would still lead to problems because Emacs under Windows
> likes to use the default Unix "/" separator, so it makes more sense to
> tell python-mode to use "/".
>
> To manage notifications about this bug go to:
> https:/