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
202 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 ...
1
vote
0answers
34 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
253 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 ...
2
votes
1answer
179 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
100 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
60 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
269 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
46 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
71 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
28 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
63 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
2answers
423 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
1k 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
329 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
60 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
46 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 ...
10
votes
1answer
802 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 ...
2
votes
2answers
151 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
106 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 ...
2
votes
1answer
328 views

python interpreter within emacs fails on simple test on __main__ (syntax error)

This small program runs well in Terminal : mac2011% cat bug.py print(__name__ == "__main__") #if True: if __name__ == "__main__": print("main") else: print("not main") mac2011% python bug.py ...
0
votes
1answer
102 views

how can I change the inferior Python process

I would like to be able to start Python 3 and ipython from Emacs in an inferior mode buffer. Currently start interpreter C-c C-p starts 2.7. I know there must be a way to change to start another ...
0
votes
2answers
254 views

How to save and execute a python file?

I do not prefer python-mode. I would like a generic way so that I can understand emacs. I wish the file be saved and python file command then be run as if in a shell.
2
votes
0answers
301 views

Jedi fails to start Jedi EPC Server because python 3.8 is installed and 3.7 not

Is the only solution to downgrade python 3.8 to 3.7 or wait till it is supported? Or are there other options? The error message is this: Error (jedi): ================================ Failed to start ...
1
vote
1answer
83 views

Auto fill of # style comments in Emacs python-mode not working

My expectation is that, like for comments in other language modes besides python, I could write a long comment, say 150 chars, and it would automatically fill, i.e., newline and indent with comment ...
0
votes
1answer
93 views

Python for set globals()[''] variables having undefined name warning message

I am using flycheck for for Python. For global files that I set using ( globals()['variable']), and later used, it gives the following warning message: undefined name <variable> [F821] Example: ...
0
votes
1answer
155 views

How to edit code in the source window using realgud?

I've started using realgud:pdb for python debugging in emacs: https://github.com/realgud/realgud When you begin a realgud session, it opens a command window and a source window. Keys like 'n' and 'b'...
1
vote
0answers
123 views

Identation issues in python mode

almost everytime, I cope e.g. snippets from the web and paste it with M-w in a python buffer the indentation is all wrong. Sometimes slanted to the left, sometimes to the right. Often all of the ...
2
votes
2answers
941 views

Set RPC Python when using elpy with virtualenv

I'm having trouble getting my elpy setup to work smoothly. My current config is: Elpy Configuration Virtualenv........: (/home/jeff/Documents/Proj/myenv/bin/) RPC Python........: 3.7.3 (/usr/bin/...
0
votes
1answer
51 views

In spacemacs, how do I copy code from the history in python REPL to my window which has a python source code file open?

I'm new to spacemacs -- I'm using it as a Python IDE. I'd like to know if there is an easy way to copy lines from the history on a REPL back to the source-code window. The idea is, I prototype in ...
2
votes
1answer
62 views

What's the idiomatic way of overriding a key binding for a given major-mode (but no other)?

I'd like to bind C-x C-e to python-shell-send-region when I am in python major-mode. In my config file, I have an add-hook for python mode, but I'd like this keybinding override to be removed/...
0
votes
1answer
95 views

Can you configure python-mode, elpy-mode to apply font-locking to imported library functions?

This question is likely an expansion / duplicate of this question: how to highlight imported functions in python code? My .py file looks like this: from math import floor (max(1, 8)) (floor(3.7)) ...
0
votes
0answers
35 views

Run-python problem Emacs + Anaconda (virtualenv)

When I used run-python through 'c-c c-p', I got the messages like below. I don't know what it is. Anaconda within GNU emacs in Mac. It doesn't seem like a problem, just came out.
1
vote
1answer
749 views

Python shell warning about readline and completion?

*Warning*: Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and "python3" is not part of the ‘python-shell-...
0
votes
3answers
283 views

Python and electric-indent: newline autoindent disregards previous blank line

This is (yet) another question related to electric-indent-mode and Python, but since I couldn't find what I address here in the other ones, here we go. I find the behavior of electric-indent-mode ...
1
vote
0answers
26 views

Why does this org session src block not give me the right results?

I am trying to up my literate coding chops and solving some programming challenges with it. Here is the full writeup of the exercise I'm playing with Mostly everything works and I understand ...
1
vote
1answer
502 views

Stop company-lsp from completing function arguments

I try to configure lsp-mode and company-lsp with python-language-server for python autocompletion, but when I choose completion candidate it completes with function arguments. How can I prevent this ...
2
votes
1answer
243 views

emacs lsp-mode python how to disable certain warnings

lsp-mode complies to PEP8 style guide I guess, but how can I disable certain warnings, e.g. about missing docstrings etc.?
1
vote
2answers
217 views

Why is my Python indentation set to 8 locally by default?

I'm running Emacs 25.2.2 on Ubuntu 18.04 for WSL. I launch emacs -q and open a new Python file, test.py. As soon as I hit the Tab key, I notice the indentation is 8 spaces instead of 4. I don't like ...
0
votes
1answer
73 views

How to unpack a tuple from org-sbe evaluating a python code block into multiple columns of a org-table?

I often encounter situations where I can easily think of python code that, given some input values, computes multiple output values at once. As an example, consider the following simple code-block ...
3
votes
2answers
1k views

How can I make python3 the default in Emacs 25.2.1?

I do have python3 on my laptop. $ sudo find / -name "python3" | python3-locations.org (partial list of locations) /usr/local/bin/python3 /usr/lib/python3 /usr/share/doc/python3 /usr/share/...
0
votes
0answers
43 views

Is there a pexpect like automation for serial-term or term-mode

Is there something similar to pexpect that can be used to automate a tty connection running inside emacs, i.e. in term-mode or on top of serial-term ? I'd like to automate some repetitive tasks like ...
0
votes
1answer
2k views

Running lsp-mode with Python using the pyls from the virtualenv of my project

I wish to run LSP using the pyls from the virtualenv of my project. I don't have pyls installed globally (only in the local virtualenv). I found this snippet online: (lsp-define-stdio-client lsp-...
0
votes
0answers
60 views

C-x C-f causes python shell to start in python-mode

I normally use C-x C-f to counsel-find-file by every time I try using it in python-mode, it starts up the Python Shell in a buffer. I've tried investigating whether there is a hotkey conflict using "C-...
0
votes
1answer
332 views

Evaluate single line of python code from Emacs org-babel

Consider a block of python code in an org-mode document: #+begin_src python num1 = input("Enter a number: ") num2 = input("Enter another number: ") result = float(num1) + float(num2) print(result) #...
2
votes
0answers
393 views

What are the steps to set up elpy to use the anaconda python distribution on Windows?

I have anaconda installed on Windows (Windows 7), and it is working well in Jupyter. But of course I'd prefer to work in emacs. I have elpy installed in emacs, and it successfully sends commands to ...
1
vote
1answer
112 views

Remove extra prompts in Emacs Babel Python session

When I run the following code block from Emacs org-babel: #+BEGIN_SRC python :session *Python* :results output print("Hello World") #+END_SRC This is what prints out in my *Python* session: >...
2
votes
1answer
218 views

Org-babel python with session breaks output

If I run the following code block: #+BEGIN_SRC python :results output print(" /|") print(" / |") print(" / |") print("/___|") #+END_SRC I get the result as expected: #+RESULTS: : /|...
3
votes
2answers
749 views

company-lsp complains about void function lsp--client-completion-in-comments

my emacs lsp-python setup is pretty standard: (require 'lsp-mode) (add-hook 'python-mode-hook #'lsp) (require 'company-lsp) (push 'company-lsp company-backends) (add-hook 'after-init-hook 'global-...
2
votes
2answers
2k views

Running Anaconda Python within emacs on Windows

I have a Windows 10 machine, with the official GNU emacs Windows build, and Anaconda Python 3.7.3. I can't get Python to properly run within emacs. Whenever I start Python, I get the message: ...
0
votes
1answer
347 views

Spacemacs org-mode python session plotting problem

I have been using org-mode with R in Spacemacs for a while now with no issue. I'm moving my workflow from R to Python. Jupyter notebooks (EIN) works great, but I prefer org-mode: Normal (non-...

1 2
3
4 5
11