emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Edmund Christian Herenz <christian.herenz@astro.su.se>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: Tangling python code results in mixed tabs and spaces, incomaptible with python3 [9.1.4 (9.1.4-dist @ /home/ehere/emacs-scripts/org-9.1.4/lisp/)]
Date: Thu, 21 Dec 2017 14:56:04 +0100	[thread overview]
Message-ID: <873744kwwb.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20171220182448.6ltm4m4emmt7ftxv@knuspertop> (Edmund Christian Herenz's message of "Wed, 20 Dec 2017 19:24:48 +0100")

Hello,

Edmund Christian Herenz <christian.herenz@astro.su.se> writes:

> The following python code uses only whitespaces for the different
> indentdation levels:
>
> a_list = ['elem1',
>           'elem2',
>           'elem3']
>
> for elem in a_list:
>     print(elem)
>     for char in elem:
>         print char
>
> I enter this code into a SRC block with
>
> #+BEGIN_SRC python :tangle blank_test.py
>
> #+END_SRC
>
> by pressing C-' inside the block (which opens the editing buffer
> python-mode).  Then I press C-' again, after which I tangle the code
> to blank_test.py by pressing C-u C-c C-v C-t.  The resulting file
> blank_test.py will contain a mix of tabs and spaces for the different
> intendation levels.  (I checked this with whitespace.el).
>
> Above behaviour is a bug, since Python3 forbids mixing of spaces and
> tabs. (Python2 is more relaxed about mixing of tabs and spaces). Thus,
> the above code, syntactical correctly entered into an OrgSrc buffer,
> will result in code that can not be run in python3 when tangled from
> an org-mode file.

Have you tried "-i" switch for the block, i.e.,

  #+BEGIN_SRC python -i :tangle blank_test.py


Regards, 

-- 
Nicolas Goaziou

      reply	other threads:[~2017-12-21 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 18:24 Bug: Tangling python code results in mixed tabs and spaces, incomaptible with python3 [9.1.4 (9.1.4-dist @ /home/ehere/emacs-scripts/org-9.1.4/lisp/)] Edmund Christian Herenz
2017-12-21 13:56 ` Nicolas Goaziou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873744kwwb.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=christian.herenz@astro.su.se \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).