Skip to main content

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
1 answer
56 views

I use pyvenv to create new environments and activate them. I, sometimes, use libs that are not in standard lib, and I usually have to install them with pip3 module/command. For example, to install ...
david's user avatar
  • 285
0 votes
1 answer
198 views

I just installed emacs 29.1 on Linux Mint. Then I downloaded and installed Doom - which seems to be operating properly. How do I enable Doom to run jupyter-python source blocks in an org document? I ...
Mike's user avatar
  • 1
1 vote
1 answer
93 views

This worked seamlessly, but at some point, I lost the ability to pass string-type variable values between code blocks in Org Babel. Let’s take the following example: #+begin_src python :session *PY* :...
martinoidar's user avatar
2 votes
1 answer
108 views

Before installing LSP, flycheck had no problem running flake8 and pylint. According to this Reddit thread this is should be possible, but I'm having no luck. LSP is enabled in my init file pretty ...
Dmitri's user avatar
  • 148
0 votes
0 answers
37 views

I'm running python 3.12 at work on windows using emacs as IDE. At home I'm running linux where my setup works without any issue. However, at work with windows I struggle to get it properly run. I have ...
swissy's user avatar
  • 107
0 votes
0 answers
53 views

To reproduce, in an inferior-python shell, type "a=[0,1]; a[0].[tab]", here [tab] means the tab key, no completion. In a terminal, the above procedure will pop up a completion list. (python-...
godblessfq's user avatar
  • 1,311
0 votes
1 answer
289 views

I want to configure Emacs to indent multiline argument lists in Python like Black or Ruff (4 spaces before each argument), but Emacs is very insistent on following PEP-8 (8 spaces). Even if I manually ...
goodmami's user avatar
  • 133
1 vote
1 answer
650 views

I've desperately been trying to use the lsp-pyright server, but Emacs doesn't seem to recognize that it's installed... What I did: Configured it like described in the docs: (use-package lsp-pyright :...
Markus Grunwald's user avatar
1 vote
0 answers
60 views

I'm trying to run a python script using selenium (that should call the executable geckodriver, installed) but, while the script runs in term, it errors in eshell (and in the python console). A minimal ...
Piripuz's user avatar
  • 11
0 votes
1 answer
202 views

Setting up bindings for Python Mode (and its Tree Sitter variant) with the following use-package form mysteriously fails: (use-package python :bind (:map python-mode-map ("C-x *&...
bci_'s user avatar
  • 33
1 vote
0 answers
27 views

After switching to Mac from Windows, the output of my python org-mode code blocks are not working properly. It keeps printing what seems to be the backend python call instead of the code output. And ...
Chris's user avatar
  • 11
0 votes
1 answer
73 views

I have following in the settings file: (setq elpy-project-root "~/Development") But it doesn't work. I have to explicitly from within emacs have to call elpy-set-project-root which works. ...
Kabira  K's user avatar
  • 105
0 votes
0 answers
121 views

I have following in my init.el file: (use-package dumb-jump :straight t :init ) (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) (setq xref-show-definitions-function #'xref-show-...
Kabira  K's user avatar
  • 105
2 votes
1 answer
432 views

I've mostly used R with ESS before, but now I'm using python for a data sciency project. My general workflow is having a split screen with code on one side and the shell on the other (I generally don'...
swhalemwo's user avatar
1 vote
1 answer
169 views

I'm trying to use org-mode to knit a document with some text and plots produced with python. However, when I export the org file to html or pdf, it doesn't output the plots, only the text and code. I ...
PavoDive's user avatar
  • 123
0 votes
1 answer
228 views

I have a Python project managed with Poetry. Poetry creates virtual environments in ~/.cache/pypoetry/virtualenvs/ where all the dependencies are installed, including pylint. This means that if I want ...
Exercise To The Reader's user avatar
0 votes
0 answers
80 views

Say I'm in foo.py and I want to paste something into the docstr of function f: something: foo bar def f(): """ """ My current workflow (evil normal mode, ...
jjk's user avatar
  • 786
0 votes
1 answer
121 views

After inserting the snippet I'm able to type the function name. But after tabbing to args, I get the error Wrong type argument: listp on typing Is it python-args-to-docstring failing at it's job? I've ...
jjk's user avatar
  • 786
2 votes
1 answer
257 views

I have the following settings on for org-babel #+PROPERTY: header-args:python :python ~/env/pt/bin/python :session a :results drawer output replace When I evaluate a code block, the results are some ...
Eric Auld's user avatar
  • 205
1 vote
1 answer
70 views

I am using GNU Emacs 29.3 on Windows 11 and have configured Elpy manually. I am a beginner in Elpy. It seems to be working as expected. I can see the auto-completion and documentation hints. However, ...
Amit Tendulkar's user avatar
3 votes
0 answers
380 views

I am using eglot (have tried both pyright and pylsp). Jumping to definition at point works, but when I select a variable imported from a different package, or the package itself, nothing happens. For ...
guibor's user avatar
  • 173
0 votes
0 answers
46 views

I know this is a pretty broad question and maybe even non-emacs related. However I don't know where to start but develop python using dap-mode Usually I have two buffers: sometest.py and a terminal ...
jjk's user avatar
  • 786
0 votes
0 answers
38 views

hello I am trying to run python application on Emacs as an IDE I installed pyel and pyright from pip and package installer but now some time the result is showing and sometime it is not trying to push ...
islam's user avatar
  • 1
0 votes
2 answers
573 views

Recently I started to use guix as my operating system. I installed python3 for my user via guix install python3. python itself is not available in the package repository, which I verified by running ...
Eldinur's user avatar
  • 13
0 votes
1 answer
36 views

My emacs is 29.2 in linux. I try below code to use output from first python block, but the output in second block is None after press C- C-c. #+name: testblock #+begin_src python print("hello&...
beetlej's user avatar
  • 1,100
0 votes
0 answers
65 views

How can I navigate from an abstract class/method to the implementations of that class/method? Using the M-. I can jump to function definition but I can't find a way to easily find the implementation.
Isky's user avatar
  • 101
0 votes
0 answers
57 views

I'm trying to use sessions within an org file to keep the code workspace as I need something similar in style to the Jupyter Notebooks. The issue I'm having is this isn't restricting the session to ...
ADS_Fibonacci's user avatar
0 votes
1 answer
898 views

I checked the elpy site but came across an error where the package cannot be found? I am new to emacs and need a little help reading the error message. The specific code in the init file I tried to ...
Ranon's user avatar
  • 1
0 votes
1 answer
69 views

I am trying to fill a region within a Python docstring. The function find-docstring-limits returns the limits of the docstring. Here is the function: (defun indent-docstring-paragraph () "...
olivaw's user avatar
  • 151
0 votes
1 answer
120 views

I'm trying to define a custom Python skeleton and have found there are two macros in python.el that might be of use here. After poking around and looking at the value for python-skeleton-autoinsert it ...
slackline's user avatar
  • 377
0 votes
1 answer
173 views

When I make an Org Babel shell code block with for instance a :session a header argument, it automatically makes a buffer a with the shell for this session, so I can explore it interactively. This is ...
Eric Auld's user avatar
  • 205
0 votes
0 answers
29 views

When I run an Org Babel shell code block with e.g. :session a header argument, it automatically opens a buffer a with the shell for this session, so I can explore it interactively. I love this feature!...
user42475's user avatar
0 votes
1 answer
82 views

Python buffers support comint-delete-output, but if I forget to do it before entering another command, I have a big hunk of text I can't easily erase. In shell mode, I can set the mark and run comint-...
Eric Auld's user avatar
  • 205
0 votes
0 answers
83 views

When editing an existing docstring in Google style you need to call a function like fill-paragraph to cut the long lines while preserving the proper indentation. However fill-paragraph will not work ...
olivaw's user avatar
  • 151
0 votes
1 answer
187 views

OS: Windows 11 (64 bit) Python version: 3.12.0 (64 bit) Emacs version: 29.1 I use LSP mode in Emacs for Python programming and I have in my Emacs init.el file the following: (custom-set-variables ...
user17911's user avatar
  • 163
0 votes
1 answer
574 views

I'm trying to use eglot on gem5, but I've noticed that I need to specify the analysis directory as src/python, and I understand that it seems to be possible to set this by setting eglot-workspace-...
Thysrael's user avatar
  • 103
0 votes
1 answer
157 views

Load up Emacs in the default modes, i.e. emacs -Q. After this, make a new .Org file with the following contents and run the Emacs Lisp code. (setq org-babel-python-command "python3") (setq ...
J. Mini's user avatar
  • 265
0 votes
0 answers
207 views

I have a python program that I edit in emacs. However, sometimes when I save it, it gets re-indented, and in doing so, messes up the indentation of sections, where I have some code and then some ...
Christopher Clark's user avatar
4 votes
2 answers
363 views

I have a python code block in an org-file that when executed results in some error. I was expecting to see that error in the #+RESULTS: block, but it doesn't show up. I have to navigate to the python ...
skittish's user avatar
0 votes
1 answer
49 views

I want to make a function that will set the correct major mode based on the interpreter used for a script. I don't want to include extensions in my scripts (because that can be annoying if making cli ...
Hackerman's user avatar
0 votes
3 answers
157 views

when python code block gets larger, it's hard to find the right indentation level def foo(): for a in l: # l1 # l1-1 for b in k: # l2 print(a) # (2) print(b) ...
eugene's user avatar
  • 539
3 votes
0 answers
304 views

I use pylint in flycheck via the python-flycheck plugin. By default it uses emacs's virtualenv which lives here: ~/.emacs.d/.python-environments/default on my machine. I would prefer if it used the ...
Att Righ's user avatar
  • 837
0 votes
0 answers
73 views

I am getting the wrong indentation for closing braces when I use electric-pair mode in python. For example, if I place the cursor (|) like so : for i in range(10): foo = [|] and hit return, then ...
SLesslyTall's user avatar
0 votes
1 answer
168 views

I would like to know if it's possible to configure LSP mode to start the Python server when I work on a snakemake file (snakemake-mode), as I use heavily use Python in this mode also.
R-addict's user avatar
0 votes
0 answers
54 views

Company mode suggests the right completions, but when I press RET I get weird characters, probably denoting the position, I was expecting to be able to cycle between each of these spots with tab or at ...
geckos's user avatar
  • 151
0 votes
1 answer
46 views

I want to change the exported tag of #+begin_src python .. #+end_src exports to \begin{verbatim} ... \end{verbatim} I want it to be export to \begin{python} \end{python} Anyone has any idea ?...
barak diker's user avatar
0 votes
0 answers
66 views

Am doing the following for org files. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) What should I do for python ?
Dilna's user avatar
  • 1,473
1 vote
1 answer
189 views

I would like to use emacs for learning python with numpy. How can I proceed ? Have seen other using Jupyter but would prefer using emacs instead. Would it be possible to have a simple example using ...
Dilna's user avatar
  • 1,473
0 votes
1 answer
102 views

According to the NEWS for Emacs 28.1 (Ctrl-f "OSC 8, for hyperlinks"), the comint-mode supports the OSC 8 styled links. But when I compile (interpret) a file "test.py" with ...
scribe's user avatar
  • 1,160
3 votes
1 answer
476 views

On Emacs 29, Python 3.11.3, IPython 8.13.2 A strange behavior seems to have recently started. When opening a python shell with run-python and then python-shell-send-buffer or python-shell-send-file ...
Metropolis's user avatar

1
2 3 4 5
13