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

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.

0
votes
0answers
16 views

Can't get pdb nor realgud:pdb working

I run pdb which command python -m pdb pom.py but I only get single line of output Current directory is <current working directory>. When I press q and RET, the buffer changes to pdb with ...
0
votes
0answers
16 views

Python completion for remote package

Context: I'm programming in Python with spacemacs on my host Linux machine. In my code, I'm importing a package that only runs on Windows, because it interfaces a software --- through comtypes --- ...
1
vote
0answers
5 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
27 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-...
0
votes
0answers
27 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. that is sweet. However, since ...
1
vote
1answer
46 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
1answer
89 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
22 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
19 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
26 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
192 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
46 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
57 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
15 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
37 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
35 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
0answers
49 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
29 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
41 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
74 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
54 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
172 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
72 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
217 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
76 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
220 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
66 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 ...
0
votes
0answers
125 views

Why are my .dir-locals not being applied even though they are loaded

Still on a never ending quest to get per project settings working for python using tramp and .dir-locals. Hitting a strange problem when I open a buffer I am asked if i would like to run my .dir-...
1
vote
1answer
141 views

flycheck cannot find python-pylint on macOS

I have installed pylint with: pip install pylint and it is in the following path: $HOME/miniconda2/bin and I have add the following to my .bash_profile: export PATH="$HOME/miniconda2/bin:$PATH" But ...
1
vote
0answers
131 views

How can i resolve tramp-error: Not a Tramp file name: using a /docker address?

Trying to set up .dir-locals to use a custom python interpreter inside a container so i can use run-python and get the REPL inside the container. I have this setup which seems to partially work in ...
0
votes
0answers
68 views

Company-quickhelp mode pop-up issue

Has anyone had a problem, where company-quickhelp mode doesn't show the last line or some line properly. This doesn't happen for all pop-ups only for some but quite a few.
0
votes
0answers
66 views

How do you run tests in anaconda mode?

Elpy has support for running test using your test runner. Looking at anaconda it does not seem to do the same functionality is there a package that can detect all your tests and let you run them ...
0
votes
1answer
101 views

Can not activate a virtual environment in emacs, but can through the usual shell

I created a virtual environment that I can activate used a command line from Terminal (Ubuntu): source/bin activate I did what follows to achieve the same on emacs: M-! then source/bin activate ...
1
vote
1answer
52 views

How to move elpy interactive python shell from bottom to the side?

I am using elpy as a python development environment. when I run a code in interactive python shell it shows the output in the bottom of the window. Can I move this bottom interactive python shell to ...
1
vote
1answer
68 views

how to change realgud:pdb pdb command

emacs' GUD (GrandUnifiedDebugger) provides way to change get pdb command name by using. (setq gud-pdb-command-name "python -m pdb") is there the way to do same with realgud
1
vote
0answers
160 views

debugging: how to optimize a RealGUD workflow

I code in Python and I my workflow uses debuggers (I coded for 8 years in Matlab). I develop numerical simulation codes: most of the time it returns a result, the question is: "Is the result right?" ...
0
votes
0answers
27 views

Python RuntimeError freezes the whole Emacs!

This happens to me almost every time after i have broken an infinite loop (RuntimeError: maximum recursion depth exceeded while getting the str of an object) in the Inferior Python process with C-c C-...
2
votes
0answers
129 views

How to syntax highlight Python f-strings so {…} uses regular code colors?

Python 3.6 supports F strings, eg: So: print(f'Test {} me!'.format(2 + 2)) Can be written as: print(f'Test {2 + 2} me!') Which print's Test 4 me, Is there a way to adjust emacs syntax ...
4
votes
0answers
113 views

list of current variables in a buffer for Python code

I would like to find a way to reproduce the "Workspace" of Matlab or the equivalent "Variables" window of the awesome pudb debugger directly in emacs for python code: it is a window which details the ...
0
votes
0answers
25 views

Prevent cursor from switching to Python shell with `C-c C-p`

If you type C-c C-p from a Python file (I am using Python 3.6.4 and emacs 25.2.1) then a Python process will be started in a Python shell (which is created if not already existing). If you then press ...
0
votes
1answer
84 views

Problem with emacs and input() using iPython 3.6.4

I am using emacs 25.2.1 Look at the following simple code: import sys def yes_no_barrier(message): print(message + ' (yes/no): ') while 1: s=str(input(message + ' (yes/no): ')) ...
2
votes
0answers
66 views

How to control emacs externally?

I'm developing an app in python which sends commands to a running emacs instance. Currently, I start an emacs server and send the commands through the command line, like this: subprocess.call(['...
1
vote
0answers
152 views

python “WORKON_HOME” not showing virtual environments in helm

I've check to see my WORKON_HOME env is set to where I want it at /home/user/anaconda3/envs but in helm the only option i get is .. if I select that option Emacs thinks my virtual environment is ...
0
votes
1answer
73 views

How do I use a Python library in emacs?

I am trying to use Webkit, but I can't get emacs to find the necessary python library EPC that I installed via pip (in Anaconda). Here is the error message: Debugger entered--Lisp error: (file-error "...
0
votes
0answers
41 views

Spacemacs - Need to kill the python buffer every time I want to run the code

I am using python mode in spacemacs and it works fine. The problem is that every time I want to run the code I need a new instance of the console. So, I always need to kill the *python* buffer and ...
1
vote
1answer
209 views

No native completion with python3 in Emacs 25.2

On Emacs 25.2 and Python 3.5 on an Centos-like Oracle Linux I have the issue that invoking a python shell gives me no completion. To reproduce, start $ emacs -Q --eval '(setq python-shell-interpreter ...
1
vote
3answers
245 views

How to run blocks/cells of python code in emacs?

https://i.stack.imgur.com/TIxlR.png The picture shows what I mean by "block" - I mean a cell of code that is delimited by some sequence of characters, in this case '#%%', that can be executed by the ...
0
votes
0answers
46 views

Having trouble with C-c C-c Python 3

I asked a question about having problems running Python 3 because C-c C-c wasn't working and instead would get stuck on sending my program and nothing would happen. I followed the answer that was ...
0
votes
0answers
21 views

Having Trouble Running Python 3 in emacs version 25.2 [duplicate]

When I use C-c C-p to start a python process I get this warning: Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t ...