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
0
votes
0answers
14 views

Python automatically add import statement

Is there a way to automatically add imports to python code within emacs? def f(x: str) -> List[str]: I want to be able to have my guess over "List" press a key binding and magically add ...
1
vote
1answer
42 views

How do I make emacs indent relative to the beginning of the previous line?

Here's how emacs indents e.g. Python code: a = myfun(b, c) I'd like it to be this way: a = myfun(b, c) Reasoning? If I later replace myfun with myfunction, in the first case it becomes:...
0
votes
1answer
30 views

Pandas data frame as table

I'm enjoying learning org-babel to write literate documents and am trying to include summary tables produced by Pandas describe(). I found an old thread with some answers but none of the provided ...
0
votes
0answers
49 views

Python : name '__file__' is not defined

So as you can see, in my terminal, I was able to execute the file without error, but once I tried from the python shell, whether in the terminal or the one integrated in Emacs, there is an error, it ...
0
votes
0answers
36 views

Unable to change emacs python indent

My Emacs's python-indent-offset is fixed at 2, even though I have the below code in my init.el to set it to 4. I used C-h v to describe the variable, it says its value is 2 and default is 4. I removed ...
0
votes
0answers
15 views

virtualenv selection menu shows only the first few virtualenvs

I have a number of virtualenvs, currently 40, but when I try to select one via the drop-down menu in emacs, it shows only the first 30 or so. Is there a way to get a scrollbar attached to that menu, ...
0
votes
0answers
22 views

How to use exuberant ctags with python?

I followed instructions here: https://github.com/leoliu/ggtags I've enabled the following: (add-hook 'c-mode-common-hook (lambda () (when (derived-mode-p 'c-mode 'c++-mode '...
0
votes
0answers
19 views

How could I see the output of my Python code in the echo area?

When I press C-c C-c(python-shell-send-buffer), I get output shown below. Afterwards when I do the same operation (C-c C-c) I always see Sent: #!/usr/bin/env python3... in the echo area. I just want ...
0
votes
0answers
17 views

Why Jupyter console sometimes decide to output sometimes don't?

Problem I don't know why my Jupyter console sometimes doesn't output anything. An example is this: Notice that only the first line gets its output. I use C-enter to execute each line. Line 2, 3, 4, ...
0
votes
0answers
21 views

Ipython console on emacs like Spyder IDE

I am use Python sympy on IDE Spyder and the equations are shown on console, but in Emacs the equations are shown in another windows with ImageMagick. I want configure my Emacs like Spyder the show ...
0
votes
1answer
43 views

Problem with Flycheck and Python

I think that this is a newbie question, but here it goes: I have installed Flycheck just as in the official page. Therefore, in my .emacs file I added the following lines (after installing): (package-...
0
votes
1answer
32 views

How could I disable all python shell interaction in emacs

How could I disable all python shell interaction in emacs on python-mode? Such as: C-c C-z open a python shell C-c C-c run the content of the buffer in the opened python shell C-c C-r ...
0
votes
0answers
7 views

ein extension causing a cycle of Fundamental and Python mode

ein extension causing a cycle of Fundamental and Python mode between input and output cells causing emacs linum mode to go bonkers. Any fixes available!
0
votes
1answer
25 views

How to export an octave/matlab array for use by python in org-mode?

I am trying to pass the value of an octave/matlab array into a python code block in org-mode. But I can't get the python-end to receive the value. With the answers in this question, I can generate an ...
1
vote
0answers
19 views

How to run current buffer as python module from project root in Elpy mode?

Take for example I have the following project tree. repo | +-root | +-__init__.py +-__main__.py +-packageA | +-__init__.py +-__main__.py My buffer is currently at root.packageA....
0
votes
0answers
64 views

Super confused with lsp-mode… inconsistent documentation with Microsoft LSP + virtualenv

Here is my lsp-mode config: (use-package flycheck :ensure t :init (global-flycheck-mode)) (setq lsp-keymap-prefix "H-l") (use-package lsp-mode :hook (;; replace XXX-mode with ...
1
vote
1answer
31 views

automatic prettier for python code? (as in javascript)

https://github.com/prettier/prettier-emacs does formatting for javascript wonder if there's an equivalent for python code?
1
vote
1answer
141 views

Saving Python matplotlib figures with source-code blocks

So I am trying to create a Data Science workflow using org-mode source-blocks. Basically, I need to emulate the jupyter notebook functionality where you create a plot and it shows the figure. Now, ...
1
vote
0answers
28 views

What is the flying trashcan icon replacing colons in Python buffers?

There is a strange icon appearing in place of colons (:) in my Python buffers. I cannot identify it easily using C-x = or any other command to inspect the character at the point because the icon ...
0
votes
1answer
17 views

How to find usages of a variable/function etc in Python?

So going to the declaration is great. However I want frequently to go the other way. There used to be a way to do this with one of the older ada-modes, but I've not seen anything in the python support ...
1
vote
0answers
33 views

Virtual environment management for python.el without changing the general PATH variable in Emacs

I try to use virtualenvwrapper.el with the build-in python.el and my virtual environments in a ./.venv directory inside each project. Because all virtual envs have the same name .venv I cannot make a ...
0
votes
0answers
15 views

Is it possible to run a wxpython app within Emacs?

I'm definitely transitioning to Emacs. But I can't manage to run within Emacs (vanilla on Windows 10) a simple script using wxpython: -*- coding: utf-8 -*- """Quick test for emacs and wxpython""" ...
0
votes
0answers
15 views

Python-mode: visual feedback that code is running

ESS has a useful little visual indication that some code is running and therefore the repl is locked. It looks like a little spinning bar in modeline. Does python-mode have something like this?
0
votes
1answer
56 views

configuring spacemacs for python development

It's been really frustrating trying to get spacemacs to work so far. I've grown to really love it - coming from vim - for its capabilities in manipulating and navigating text, but it's just been so ...
1
vote
0answers
11 views

auto intendation on newline doesn't stay at same indentation for python docstring

Ubuntu 19.10 emacs 26.3 from system repos I do use elpy and evil-mode In general when I am editing python code, indentation works just fine. However, when I am editing doc-strings, when I type enter ...
2
votes
2answers
55 views

stop stripping result of :session for python print statement

Since default value for :result header is value print statement will only show with :result output #+BEGIN_SRC python :results output print(' hello') #+END_SRC #+RESULTS: : hello but same ...
0
votes
1answer
79 views

Working Around the OS X Catalina Conflict with Emacs 26.3

I'm struggling to workaround the problem discussed in this post. I'm working through the accepted solution (which also references this post, and getting what I think is close, but not quite there. The ...
0
votes
1answer
30 views

How to enable python-pylint for the all files by default?

I can enable python-pylint for a opened Python file doing: M-x flycheck-select-checker and enter python-pylint It think it says C-c ! s to enable it on all Python files.(the message hides itself so ...
1
vote
0answers
20 views

Python: check import module for local functions

For example I have a log() function under lib.py file: usage (from lib import log). Afterwards I move log() function into utils.py file. So usage should be: (from utils import log). But elpy or ...
1
vote
0answers
23 views

How do I debug a flask application from within emacs?

I want to use something like pdbpp or ipdb to debug a flask application. I've tried but not understood how to set a breakpoint in a python file that's part of a wider application and see it hit. There ...
1
vote
1answer
35 views

“python3 -m venv” support in emacs

pyvenv and virtualenvwrapper emacs packages work well with virtualenv, but neither appears to support the core venv module which is now packaged with releases of Python. Are there any actively ...
0
votes
0answers
12 views

ropemacs installation

I am trying to install ropemacs (https://github.com/python-rope/ropemacs) using: (require 'pymacs) (pymacs-load "ropemacs" "rope-") and did: pip install ropemacs Which gives me following error: ...
2
votes
0answers
62 views

flycheck - elpy - flake8 - ein and .ipynb files

I have set up Emacs (on Mac Catalina) with Elpy to handle Python. I also managed to get Jupyter notebooks (.ipynb files) working with Elpy via Ein. Both .py and .ipynb compile and use Flycheck ...
0
votes
0answers
27 views

Open buffer created by run-python in the current window

I recently started using spacemacs, and have a newbie question about modifying the way run-python works. When I execute run-python, a new buffer is opened in a different window. I'd like to change it ...
1
vote
0answers
33 views

Elpy: how to stop the underlying RPC process?

Whenever elpy-mode is activated upon visiting a python file, I see a py.exe executable start, with a subtree of processes. This should be the remote procedure call (thanks @al0 for the explanation). ...
1
vote
0answers
22 views

Python debug mode in Emacs

I'm looking for a python debug debug mode in Emacs that allows me to start flask apps in debug mode and interact with them. Is there something that does this and and a step through on how to use it? I'...
1
vote
1answer
60 views

Any equivalent of R+ESS for python?

I do a lot of R coding on Emacs – on Windows – using the wonderful ESS package. What I particularly like is that I can: start an R session, and then send lines or regions of the script I'm working on ...
0
votes
1answer
30 views

Emacs (ipython) inferior python shows strange input numbers

In emacs, I use ipython in the inferior python mode with config: (setq python-shell-interpreter "ipython" python-shell-interpreter-args "--simple-prompt -i") When I edit my .py file, without any ...
0
votes
1answer
70 views

Make buffer unreachable

This may be a silly question, but how can I make a buffer unreachable? I have enabled live-py-mode. Every time I try to edit my python file it evaluates the code, which is a well and good but it's a ...
1
vote
0answers
24 views

org-babel python :session names matter

For example, I get #+BEGIN_SRC python :session sdfjkl :results output import numpy #+END_SRC #+RESULTS: : Python 3.8.0 (default, Oct 23 2019, 18:51:26) : [GCC 9.2.0] on linux : Type "help", "...
1
vote
1answer
45 views

Why needs syntax highlighting often a `revert-buffer`?

Quite frequently, syntax highlighting in a given buffer is broken (i.e., a big fraction of the code is not highlighted). This is definitely not due to syntax errors, and the point at which ...
0
votes
0answers
44 views

disable automatic python file scrolling if using blacken or yapfify

I am using blacken to automatically format my python files (use-package blacken :demand t :after python :init (add-hook 'python-mode-hook 'blacken-mode) ) (use-package python :mode ("\\.py\\'" ...
0
votes
2answers
94 views

Emacs occasionally using wrong indent in python

I have a bunch of python files (ie .py files), which I use Emacs to edit. However I keep having the issue where sometimes emacs will indent regions with 8 spaces instead of 4, and I can't figure out ...
2
votes
1answer
179 views

“Backspace” key sometimes also deletes forward in python-mode

Start Edit 1 To answer questions. Emacs Versions: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-...
-1
votes
1answer
54 views

Autocomplete suggestions after dot in python using company-mode

Jedi has support for auto-completion after dot (setq jedi:complete-on-dot t) => Main goal is to Finding what methods a Python object has [Q] Does company-mode has the same support (complete-on-dot)?...
0
votes
1answer
27 views

Elisp to get the language mode for the current ein cell?

When I'm using ein to run a python jupyter notebook, the major-mode variable is just "ein:notebook-multilang-mode" which makes it ambiguous what the current language is. I have elisp that only ...
1
vote
1answer
25 views

How to disable hints for certain keywords in python elpy

I enabled elpy mode for python and I get hints when I type a keyword. Also I have yasnippets. Unfortunately, when I type "for" keyword, elpy gives me a useless hint, blocking <tab> key for ...
9
votes
1answer
252 views

How to highlight in different colors for variables inside `fstring` on python-mode

I am using python-mode which colors the parameters. When I concatinate strings the variable color is represented as different: On the other hand, if I use fstring, the variable is not represented as ...
0
votes
2answers
58 views

How to navigate to the next/previous python class?

I would like to navigate quickly between classes in Python code. I'm looking for a command to go to the next / previous class so I can bind that to a key sequence. This question is not about ...
1
vote
0answers
59 views

How to read the python documentation offline in emacs?

Sometimes I use ctrl h i or M-x woman, though I almost always head to the web for basic queries like python find line in string. Do I need to download this[0], that[1] or something else before leaving ...

1
2 3 4 5
9