473,396 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

emacs python-mode questions: C-c C-c and broken docstring fill


1. Why do I get this in my minibuffer when I do C-c C-c in a
python-mode buffer containing the following valid Python code?

Wrong type argument: sequencep, cpython

----START
#!/usr/bin/env python

print "hello, world"
----END
2. A while ago I 'upgraded' to a version of python-mode (from
somewhere on sourceforge, I think -- perhaps Python CVS, don't
remember) which somebody here claimed was able to fill comments
without needing blank lines before and after the comment. It does do
that, but the new version also breaks filling text in docstrings
(under particular circumstances which I haven't figured out, but which
occurs very frequently). I get something like: "The parameter start
is not the beginning of a python string". Where does the latest
python-mode live, and is this fill bug with docstrings fixed?
John
Jul 18 '05 #1
6 2460

John> 1. Why do I get this in my minibuffer when I do C-c C-c in a
John> python-mode buffer containing the following valid Python code?

John> Wrong type argument: sequencep, cpython

It looks like a bug in py-execute-region. It sets the shell variable like
so:

(setq shell (or (py-choose-shell-by-shebang)
(py-choose-shell-by-import)
py-which-shell))))

which gives it the value (quote cpython). Later on it tries to concatenate
it:

(let ((cmd (concat shell (if (string-equal py-which-bufname "JPython")
" -" ""))))

which fails because shell is not a string (strictly speaking, a sequence) at
that point. I'm not sure what the correct fix is.

John> 2. A while ago I 'upgraded' to a version of python-mode (from
John> somewhere on sourceforge, I think -- perhaps Python CVS, don't
John> remember) which somebody here claimed was able to fill comments
John> without needing blank lines before and after the comment. It does
John> do that, but the new version also breaks filling text in
John> docstrings (under particular circumstances which I haven't figured
John> out, but which occurs very frequently). I get something like:
John> "The parameter start is not the beginning of a python string".
John> Where does the latest python-mode live, and is this fill bug with
John> docstrings fixed?

Can you file a bug report with a small failing example? Assign it to me
(montanaro).

Skip
Jul 18 '05 #2

John> Wrong type argument: sequencep, cpython

Where the comment says "TBD: a horrible hack...": try replacing the
beginning of the let with

(let ((cmd (concat (if (eq shell (quote cpython))
"python"
"jython")
(if (string-equal py-which-bufname "JPython")
" -" ""))))

I have no idea what the "jython" string really should be. That was just a
guess.

Skip

Jul 18 '05 #3
Skip Montanaro <sk**@pobox.com> writes:

[...]
John> do that, but the new version also breaks filling text in
John> docstrings (under particular circumstances which I haven't figured
John> out, but which occurs very frequently). I get something like:
John> "The parameter start is not the beginning of a python string".
John> Where does the latest python-mode live, and is this fill bug with
John> docstrings fixed?

Can you file a bug report with a small failing example? Assign it to me
(montanaro).


OK, will try to do tomorrow.
John
Jul 18 '05 #4
Skip Montanaro <sk**@pobox.com> writes:
John> Wrong type argument: sequencep, cpython

Where the comment says "TBD: a horrible hack...": try replacing the
beginning of the let with

(let ((cmd (concat (if (eq shell (quote cpython))
"python"
"jython")
(if (string-equal py-which-bufname "JPython")
" -" ""))))

[...]

That works. Thanks.
John
Jul 18 '05 #5
jj*@pobox.com (John J. Lee) writes:
2. A while ago I 'upgraded' to a version of python-mode (from
somewhere on sourceforge, I think -- perhaps Python CVS, don't
remember) which somebody here claimed was able to fill comments
without needing blank lines before and after the comment. It does do
that, but the new version also breaks filling text in docstrings
(under particular circumstances which I haven't figured out, but which
occurs very frequently). I get something like: "The parameter start
is not the beginning of a python string". Where does the latest
python-mode live, and is this fill bug with docstrings fixed?


One situation where this can happen is if point is the at the @ in the
following triple quoted string:

"""nobody expects the "spanish" @inquision"""

The following patch should fix this I think (I haven't tested this very
well though):

*** python-mode.el.~4.35.~ Sat Jul 19 17:28:04 2003
--- python-mode.el Mon Jul 28 12:25:04 2003
***************
*** 3714,3720 ****
(py-fill-comment justify))
;; are we inside a string?
((nth 3 pps)
! (py-fill-string (nth 2 pps)))
;; otherwise use the default
(t
(fill-paragraph justify)))))
--- 3714,3720 ----
(py-fill-comment justify))
;; are we inside a string?
((nth 3 pps)
! (py-fill-string (nth 8 pps)))
;; otherwise use the default
(t
(fill-paragraph justify)))))
Bernhard

--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
Thuban http://thuban.intevation.org/
Jul 18 '05 #6
Bernhard Herzog <bh@intevation.de> writes:
[...about failure to fill...]
One situation where this can happen is if point is the at the @ in the
following triple quoted string:

"""nobody expects the "spanish" @inquision"""

The following patch should fix this I think (I haven't tested this very
well though):

[...]

Works for me. Thanks. I'll post this with the bug report I'm just
about to file.
John
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wezzy | last post by:
Hi all, i've just seen the pydebug plugin for jEdit and my question is : is there something similar for emacs ? i'm looking for a debugger frontend, a very simple program, just set breakpoint,...
49
IDE
by: Thomas Lindgaard | last post by:
Hello I am probably going to start a war now... but so be it :) I just want to hear what all you guys who eat pythons for breakfast use for python coding. Currently I use Kate, but I would...
5
by: Darren Dale | last post by:
I am using Emacs Python mode, and my project involves reading large datafiles and processing large arrays. I have some code that reports the progress during these time consuming processes. It works...
81
by: julio | last post by:
Sorry but there is no another way, c# .net and mono are going to rip python, not because python is a bad lenguage, but because is to darn old and it refuses to innovate things, to fix wrong things,...
0
by: Skip Montanaro | last post by:
I got a little carried away with the gdbinit file that lives in the Python distribution at Misc/gdbinit today. I decided there's no particular reason that gdb shouldn't display the current Python...
5
by: levander | last post by:
I've been using pdb under emacs on an Ubuntu box to debug python programs. I just upgraded from Ubuntu Edgy to Feisty and this combo has stopped working. Python is at 2.5.1 now, and emacs is at...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
4
by: Richard Szopa | last post by:
Hi All, I am a devoted Emacs user and I write a lot in Python. However, I never managed to get my Emacs configuration right for this purpose. There were some discussions on this, but the threads...
14
by: jmDesktop | last post by:
Hi, I'm trying to learn Python. I using Aquamac an emac implementation with mac os x. I have a program. If I go to the command prompt and type pythong myprog.py, it works. Can the program be...
0
by: xahlee | last post by:
Here's a little tutorial that lets you write emacs commands for processing the current text selection in emacs in your favorite lang. Elisp Wrapper For Perl Scripts...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.