Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

use for Python programming language in Emacs. Emacs supports several versions of the language implementation, versions, and coding styles. Python questions should augment with additional tags as appropriate as described in the description below.

1
vote
1answer
8 views

Can’t guess python-indent-offset - delete warning when local file variable

I have this comment that I write in my python file # -*- Mode: Python; tab-width: 8; indent-tabs-mode: nil; python-indent-offset: 2 -*- # vim:set et sts=4 ts=4 tw=80: But when I load a python file, ...
0
votes
1answer
35 views

Autocomplete after dot in python

I haven't used emacs before, but would like to learn how to use it properly for Python development. From the past IDEs I have used I enjoyed the feature to obtain information on possible objects ...
0
votes
0answers
14 views

elpy autocomplete stops working unexpectedly

I've configure emacs to write python code and I love it!:). It works very well but after some situations that I cannot understand the autocomplete stops working on all buffers. If I restart emacs it ...
0
votes
0answers
17 views

Cannot change flycheck-python-pylint-executable

I have been trying to make flycheck use python 3 syntax similar to this question and ended up having more fundamental questions. I open a python file and flycheck correctly works, using the python 2 ...
0
votes
0answers
16 views

run-python and interactively choose working directory

When starting an R process using ESS (M-x R) you are interactively asked for a working directory. To replicate this behaviour for python I have been opening up some random file in the directory I ...
0
votes
0answers
11 views

How can I use bandit with flycheck in Spacemacs?

How can I integrate bandit with flycheck in Spacemacs? I know there is flycheck-pycheckers. But I would prefer to have a separate integration for bandit only.
1
vote
1answer
42 views

Activating a conda environment in emacs

I've got code that needs python 2.7 (and other environments) C:\Users\Me>conda info -e # conda environments: # base * C:\Program Files\Anaconda3 python2 C:\...
-1
votes
0answers
17 views

How to use the previous command in pdb in emacs shell mode

If I use pdb in Emacs shell I cannot use arrow keys or M-p go view previous commands. Is there a way to enable this?
1
vote
2answers
49 views

Babel + Python function definition with for loop causes IndentationError

I am using orgmode and Babel to run Python source code blocks. I noticed that if I define a function that returns a value, and if this function has a for loop inside it, then evaluating it with Babel ...
0
votes
1answer
31 views

python-shell-completion-complete-or-indent no mathes in ipython

import pandas as pd pd. # press tab, there are completions df = pd.DataFrame() df. # press tab, No Matches Same configuration worked on my local mac but not on linux server. If I use python ...
0
votes
1answer
17 views

Anaconda Mode only complete module variables, get No Matches for assigned variables on linux server accessed via ssh

Description Anaconda Mode only complete module variables, get No Matches for assigned variables on linux server accessed via ssh Reproduction guide Observed behaviour: - Start Emacs execute import ...
1
vote
0answers
26 views

Jedi doesn't work properly with PyQt5

I have auto-complete and jedi installed and everything works just fine except autocompletion in PyQt5. When i try to subclass for example QWidget and in the __init__ method I type self and then press ...
1
vote
1answer
21 views

Is there an integration between projectile and python-mode that allows for one python interpreter buffer per projectile project?

I use projectile with python (and anaconda mode) to work in emacs. When starting an ipython interpreter buffer, the first such session works fine. However, attempting to start a second session, for ...
0
votes
1answer
58 views

Changes in python mode Emacs 24 → 26

Certain key combos seem to have changed behaviour from emacs 24 to emacs 26 in python mode (python.el). Notably: Emacs 24: (no python shell open yet) C-c C-c: Run python: ... ; Dedicated process?; ...
2
votes
1answer
39 views

prevent EMACS LaTeX mode from indenting pycode environment?

I'm using pythontex to allow me to embed Python code in LaTeX files. (It's really great, BTW.) I edit my LaTeX with EMACS. Unfortunately, EMACS thinks that any environment should be indented, and if I ...
2
votes
0answers
49 views

Emacs/realgud/Python: How to display variables at each step?

Using emacs and realgud one can have a separate buffer that automatically shows where the program is currently stopped (by displaying that line of source code). Is there an easy way to get realgud to ...
0
votes
0answers
65 views

Display two vertical rules, at columns 79 and 87

Python code now often is limited either to 80 columns, or to 88 columns. fci-mode allows drawing a vertical rule at a single column, but not two. I'd like to do something very similar in appearance ...
1
vote
1answer
21 views

Elpy - Close Window when invoking elpy-shell-kill

Elpy helps a great deal, when editing Python-Code. For example it let's you run the current file with C-c C-c in a new Window with a REPL. When i'm done with this, i can hit C-c C-k (elpy-shell-kill) ...
3
votes
2answers
74 views

function to convert python dict arg to kwargs?

I would like to be able to start with code like this: def foo(a, b, {"c": 1, 'd': 2, "e": 3}): then execute some emacs function with my cursor anywhere between the {} characters, and rewrite the ...
0
votes
0answers
111 views

Enhance python lsp-mode with elpy functions and keybindings

I've been using Elpy for a long time and have grown used to many of the default keybindings. I recently decided to give lsp-mode a go to see how it compares. I set it up following this blog and made ...
1
vote
1answer
49 views

Problem debugging in `gud-mode' (M-x `gdb' with `many-windows' enabled)

I'm debugging a large codebase (written in C++). Everything works perfectly if I run gdb from a regular terminal as follows: $ gdb <program-name> Reading symbols from <program-name>......
2
votes
1answer
276 views

Org-babel Python with :session

I don't know what happened with org-babel and Python recently. My intuition and my experience with preparing lectures last year was that the :session option would cause Org Mode to capture all the ...
1
vote
0answers
39 views

Flycheck Python introspection into modules?

I have flycheck working seemingly as advertised with Python on Emacs 25.2.1. The configuration check shows all dependencies are satisfied and enabled. It does handle introspection within the same ...
1
vote
2answers
113 views

Kill inferior python in python.el mode

At the moment I am killing the Python interpreter with C-d each time I want to quit Python interpreter. What is the name of the function to kill the Python interpreter in Python mode (the one which ...
1
vote
0answers
13 views

Flycheck error buffer empty for python files in the {package-name}/bin/ directory

I have this odd problem when I run flycheck on the python files inside the {package-name}/bin directory of my git repository. When I attempt to run flycheck on these files, the buffer with the ...
0
votes
0answers
106 views

(wrong-type-argument number-or-marker-p nil) when calling run-python

When I call run-python from the package python.el Emacs displays me the following error: error in process filter: Wrong type argument: number-or-marker-p, nil To investigate further I called toggle-...
1
vote
0answers
45 views

C-c ' for editing all code blocks (to handle imports and variables)?

The Org manual says: C-c ' for editing the current code block. It opens a new major-mode edit buffer containing the body of the ‘src’ code block, ready for any edits. This feature is sweet. ...
1
vote
1answer
72 views

Open a file in read-only preprocessed mode

I often create files with a special extension, e.g. pkl (python pickle), and would like to display these in a read-only buffer after processing them with some external command. E.g. in the case of ...
1
vote
2answers
334 views

emacs and anaconda ipython

I'm trying to get Emacs to start ipython from Anaconda. I have two systems which are not identical so figured setting symbolic links in ~/bin/ipython as I have ~/bin/ pre-pended to my $PATH would do ...
2
votes
1answer
43 views

ModuleNotFound for absolute imports in Emac's Python Repl

For some reason, emacs does not seem capable of evaluating absolute imports for any python project I run. Here is my project layout: ├── loxy │   ├── errors.py │   ├── __init__.py │   ├── loxy.py │   ...
1
vote
0answers
65 views

Org Mode Python block evaluation cannot print result in the shell session

I have a python source block in org mode as below #+BEGIN_SRC python :session print('hello world') #+END_SRC and I have a Python shell already run, so when i press C-c C-c, the code gets ...
0
votes
0answers
94 views

Unable to use python provided via pyvenv

Trying to configure pyvenv in Spacemacs to load the virtualenvs created in Conda without any luck so far. Current set-up: pyvenv package loaded in Spacemacs. The following in my .spacemacs file: (...
0
votes
1answer
720 views

Emacs Company-Jedi Python3 auto completion

I am trying to setup company-jedi to autocomplete for python3. The autocomplete is working for standard python3 modules; however, it is not working for packages I installed using pip3, in this case ...
4
votes
1answer
61 views

How to get rid of flickers in python shell?

In a fresh emacs session, each time I hit enter in inferior-python-mode, the window flickers. This does not happen in shell-mode. One can see the cursor goes to the middle of current window when ...
0
votes
0answers
107 views

Syntax highlighting not working in Emacs (in Python mode)

When I Python-mode I have noticed that occasionally my syntax highlighting is not working. I have noticed this when using the Cyberpunk theme as well as the Tango-Dark theme. Closing and reopening ...
1
vote
0answers
23 views

fixing python-mode automatic line-breaks in the output?

I'm using emacs python mode to evaluate python (3.6) code and expressions. The mode (or emacs) seems to automatically break output lines at a certain length, even though my screen is wide enough to ...
0
votes
1answer
86 views

Interpreter discrepancy in org-babel-python and python-mode

(Emacs version 26.1, Org version 9.1.9) I have tried numerous solutions to get working in org-mode source blocks. This solution works to change python-mode to utilize the Python3 interpreter, which I ...
0
votes
0answers
40 views

How to convert a region into a Python function?

I'm using emacs with evil and anaconda mode for Python. Sometimes I'd like to convert a region or a block of selected lines into a def (or for/while loop, or class). Is there a way to do this ...
1
vote
1answer
94 views

Using xonsh as python shell

I'm trying to use xonsh as my python interpreter in Emacs (the one invoked by run-python). I tried to do this by setting python-shell-interpreter to "xonsh". This works, but there are two issues: The ...
0
votes
0answers
48 views

Eldoc appears briefly and then disappears

When I move into the parameter list of a Python function, eldoc briefly shows the parameter help in the minibuffer but disappears abruptly. How can I find what is causing this issue?
0
votes
0answers
63 views

TAB region indentation (python)

I'm working on a .py document using a fresh apt install of emacs 25.2.2 on Ubuntu 18.04. When typing TAB with several lines selected, the behavior is not what I remember getting previously, and not ...
0
votes
1answer
178 views

Using tab as indentation in anaconda-mode with spacemacs

I recently installed spacemacs with the python mode and would like to change the default indentation to be TAB instead of four spaces. What I did is I added (setq-default indent-tabs-mode t tab-width ...
1
vote
0answers
56 views

How can I execute a python script on a given region of my buffer?

I have a .tex source and a python script called comments.py. This script reads my .tex source as input, does some operations on it and write a .com file as output. Then I have to reneame .com as .tex ...
1
vote
1answer
29 views

Can I return multi value in emacs org src code?

As follow code,can I get a list for other code block? #+name: test #+BEGIN_SRC python -n :exports both for i in range(5): return i #+END_SRC #+RESULTS: test : 0
0
votes
1answer
566 views

flycheck cannot enable python-flake8 configuration file not found

I'm trying to set up flycheck to run flake8 on my python files. I'm using pipenv so I set up flycheck-python-flake8-executable for my buffer to point to the virtual environment version of flake8 and ...
1
vote
0answers
80 views

how to “slow” down the execution of code blocks

on OSX 10.13.4 with emacs 25.3 and org-mode 9.1.12. Python is 3.5.2 with matplotlib 2.2.2 I am trying to find a way to have org-mode babel for python to slow down in some of the points of my code ...
4
votes
0answers
427 views

src python in org-mode: IndentationError: unexpected indent

mac 10.13.4 / emacs 25.3 (9.0) / org-version 9.1.12 / python 3.5.2 I am trying to understand why C-c C-c generate an IndentationError: unexpected indent when executing a simple code like the example ...
0
votes
0answers
118 views

problem when setting org-confirm-babel-evaluate to nil

apple: 10.13.4 emacs: 25.3 (9) Org-mode version 8.2.10 python3.5 As I have a bunch of harmless python blocks in an org mode file for a report, and did not want to keep pressing "y" every time ...
0
votes
1answer
471 views

Python in org babel will not work

I've recently moved to a new computer and cannot get org babel to work with Python (it worked fine on my old machine). I'm using OS X 10.12.6 with Emacs for Mac OS X based on Emacs 25.3 with org-mode-...
1
vote
1answer
155 views

Is there a package for semantic refactoring

Is there a package that allows syntax aware refactoring in python or c++. For example, extracting a value as a parameter, into a function signature, extracting a block as a function (passing local ...