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.

Filter by
Sorted by
Tagged with
1
vote
1answer
300 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
1answer
771 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
104 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
33 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
3
votes
1answer
3k 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
88 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 ...
6
votes
2answers
2k 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
283 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 ...
5
votes
1answer
3k 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-...
2
votes
1answer
1k 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 ...
1
vote
0answers
722 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
689 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
355 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
141 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
521 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
399 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
195 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
3
votes
0answers
893 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
35 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-...
10
votes
3answers
804 views

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

Update, Emacs 28 supports f-stings 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 ...
4
votes
0answers
409 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
1answer
399 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): ')) ...
9
votes
1answer
448 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(['...
2
votes
0answers
1k 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
208 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 "...
3
votes
1answer
1k 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
2k 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 ...
1
vote
0answers
252 views

Using Jedi with Cython

Is there a way to get Jedi to perform completion for Cython? One can simply use normal jedi completion; however, it does not work on Cython keywords such as cdef or when importing Cython modules (e.g....
2
votes
2answers
984 views

Configuration steps for Emacs Python / IDE [closed]

I'm newbie. Which is the best configuration for develop in Python using Emacs? Thanks
0
votes
1answer
129 views

Problem defining two python functions in org-mode

I am testing the possibility of including python code in org-mode files in emacs. As it is my first time with I ran into an error that probably it is easy to fix, but I cannot see the solution. I want ...
0
votes
1answer
832 views

python-mode: tab always indents with 2 spaces

I start up my Emacs25 with emacs25 -Q to skip any init.el. When I then open a python file with local file variables as shown below, TAB indents only two spaces, instead of four: # -*- mode: Python; ...
1
vote
0answers
506 views

run python code interactively with emacs 25 on macos

I have always used emacs with python. I generally run my code on the ipython interpreter using C-c C-c. This is my ~/.emacs.d/init.el in ubuntu where everything works fine. (setq python-shell-...
0
votes
2answers
2k views

How to run anaconda on an emacs shell?

I'm trying to get numpy and matplotlib to run from emacs so I downloaded anaconda. I've got it running on my terminal but I don't know how to run it in an m-x shell. I'm using mac os. I've ...
0
votes
2answers
2k views

How to run python 3 in M-x shell?

I am very new to emacs so it would be a big help if answers came with a lot of detail. I've tried to get my M-x shell to run python 3 but can't. I've tried: (setq python-shell-interpreter "/...
4
votes
0answers
266 views

Is it possible to debug Django from gud-pdb?

Brand new to gud/pdb and I am trying to run the Django development server from emacs. I can't seem to set breakpoints that affect the running server, though. I am invoking PDB with M-x pdb, then ...
1
vote
1answer
346 views

IPython doesn't work in a virtual environment

I've set up a virtual environment with venv and installed Ipython there via pip. On the terminal it works. Now, in my init.el, I have (setq python-shell-interpreter "ipython" python-shell-...
0
votes
1answer
278 views

Set python interpreter on a per project bases

I know i can set an interpreter with the code below, is there a way i can set this per project so that when I open emacs with a specific project it selects the interpreter for that project. (setq ...
3
votes
2answers
774 views

Emacs: Get user input when using interactive Python with `getpass`

I am, unfortunately, using Windows 7 and am running GNU Emacs 25.3.1 (x86_64-w64-mingw32) of 2017-09-26. Everything functions as expected from the command line. However, within Emacs, I encounter a ...
1
vote
1answer
594 views

How to issue commands to pdb?

I have been trying to use pdb to debug my Python program, however whenever I get to this screen I don't know what to do. Usually when I use pdb I just type commands after (Pdb), but when I try to do ...
3
votes
0answers
124 views

how to highlight imported functions in python code?

python-mode or elpy-mode in Emacs only highlight the basic Python library functions. If you work a lot with other libraries like numpy and matplotlib, would be nice to have these functions and ...
0
votes
1answer
205 views

Running python script from shell in Emacs results in delayed output

I'm trying to run a python script from a Windows shell (invoked via M-x shell or M-x powershell) inside Emacs. However, no output is shown via print statements until I after I hit a raw_input ...
7
votes
0answers
874 views

show output from python-shell-send-region

Using python.el and ipython.exe (from Miniconda3), I'd like to highlight a portion of code and execute it in the associated inferior python buffer. Example: #!/usr/bin/python3 myvar = 100+200 ...
3
votes
3answers
203 views

Is there a way to autoindent single quoted lines automatically for python code?

The python.el mode has several ways to fill docstrings, but I would like to fill single quoted lines. Is there a function that would change this: variable = { 'key': ' this is a very long ...
0
votes
1answer
121 views

Spacemacs: Layout specific python processes?

In the same spirit that Org Mode allows us to have multiple python SRC BLOCKS with different sessions running independently, is it possible to have multiple Python shells running in different Layouts ...
0
votes
2answers
104 views

Evil mode interacting with python.el (invoking skeletons)

Skeletons such as python-skeleton-if in python.el has been giving me problems - I never use them but they get invoked unexpectedly. If they are invoked, it is a pain to get out of it and also it ...
4
votes
1answer
493 views

Dedicated Python Shell?

I just upgraded emacs to 25.3. Before the upgrade when I opened a Python shell, it would ask me whether I wanted a 'dedicated' shell (for the buffer I was in), to which I usually replied 'yes'. Now, I ...
8
votes
3answers
8k views

Specifying python version in run-python

I'm trying to figure out how to specify which version of python to run when calling "run-python" (C-c C-p) in python-mode, and I've run into the following problem. These are the first few lines of the ...
0
votes
1answer
200 views

Error when trying to advice python-shell-send-string

I'm trying to write advice such that each time I eval a python snippet, it automatically output the exception time in the emacs python shell (defun python-send-with-time-record (orig-func string &...
2
votes
2answers
853 views

Setting python version for live-py and python-excecute-file (SPC m c c) in spacemacs

Im new to Emacs, i hope i didn't miss anything simple. My configuration is: OS - OSX sierra 10.12.6. Emacs - 25.3.1 (Emacs-emacs-plus from homebrew) python - trying to set 2.7.14. I want to make ...
1
vote
1answer
757 views

Magit fail git pre-commit hook with No such file or directory

I have a git pre-commit hook to run the unittest locally on my GNU/Linux manchine. The content of my pre-commit file is #!/bin/bash source activate project && python manage.py test &&...

1
3 4
5
6 7
10