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

How can I start IPython from emacs

I deleted my old Python installation, so the only Python installation remaining is the one inside Anaconda. when I start Spyder I get: Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit ...
2
votes
1answer
177 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 ...
2
votes
0answers
256 views

Anaconda Mode only complete module variables, get No Matches for assigned variables on linux server accessed via ssh

Description Anaconda Mode only complete module variables, get No Matches for assigned variables on linux server accessed via ssh Reproduction guide Observed behaviour: - Start Emacs execute import ...
1
vote
2answers
549 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, ...
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: : /|...
0
votes
0answers
17 views

Avoid font lock in special strings

Consider the following python code: As you see the content of expr is font locked as string. How can I emacs make to format it as if expr=''' and ''' were gone: Other strings should be font locked ...
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 ...
1
vote
1answer
223 views

Python-Repl issues with TRAMP Mode [windows->Linux]

I have an issue when using python-mode remotely through tramp. I'm trying to use the repl and pass a test function using C-c C-c, however this seems to create a local file at my own computer or ...
0
votes
1answer
30 views

Toggling off all settings in python and julia to get bare setup

since recently I am using LSP for python, tex and julia on macos with spacemacs develop. To some extend this is great, but it is something awefully slow using a gui... and it seems that it is not only ...
0
votes
1answer
169 views

Deleting temporary files left over from inferior-python-mode

I am using emacs on a server so files in /tmp are not automatically cleared down. Every time inferior-python-mode runs, it leaves files in /tmp (e.g. /tmp/py15458epk). I'm looking for a more elegant ...
3
votes
1answer
41 views

Org mode python code block with session does not return a result

I had been successfully using python code blocks with the :session header argument when I noticed that upon export no result was given. I then simplified my example to the following two: #+...
0
votes
1answer
1k views

getting Jedi to work with type hinting (Python)

I am trying out the Python 3 type hinting with this example: from typing import List def greeting(names: List[str]) -> str: return 'Hello, {}'.format(', '.join(names)) greeting(['jane', '...
0
votes
0answers
22 views

ANSI colors are incorrectly displayed in Inferior Python mode REPL

ANSI escape color codes, e.g. "\u001b[31m", are incorrectly printed in the Python REPL, inferior python mode. They are correctly printed in VTerm, where they are displayed the same as when ...
1
vote
2answers
1k 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 ...
6
votes
1answer
2k views

How do I change the working directory used by pdb/gud?

When running M-x pdb from Emacs, the current directory seems to be set to that of the directory of the script you are running, so pdb ~/path/to/project/__main__.py Would set the working directory ...
2
votes
1answer
180 views

How do I make emacs find `ac-source-pycomplete`?

I followed Jessica Hamrick's emacs setup before adding evil. This means that there is a lot of specific configuration issues in my ~/.emacs.d/ which I don't necessarily understand, shame on me, but ...
1
vote
1answer
209 views

wrong cwd in python mode

When i do C-c C-c on a python module, it leads to *Python* buffer with Inferior Python : run Shell-Compile mode. Suppose the correct cwd is /x/y/z/ The problem is when I print os.getcwd(), i get ...
5
votes
1answer
679 views

Problem of starting a remote ipython console

I want to connect to remote ipython server, and follow the doc of the ipython, I start a ipython server in my server by ipython3 kernel -f ~/.ipython/kernel.json --pprint and I can start a ipython ...
1
vote
0answers
19 views

How to install mspyls without internet?

I would like to install mspyls language server on my work machine that does not have access to an internet. I am able to transfer files over to the work machine via thumb drive. Is there a way for me ...
1
vote
3answers
320 views

Babel + Python function definition with for loop causes IndentationError

I am using orgmode and Babel to run Python source code blocks. I noticed that if I define a function that returns a value, and if this function has a for loop inside it, then evaluating it with Babel ...
2
votes
2answers
236 views

how can I run conda in emacs shell?

I've been using Python command 'conda' in the terminal on my Mac. But when I run a command like 'conda activate ...' in Emacs's shell (M-x shell), it gives me this objection: CommandNotFoundError: ...
10
votes
1answer
3k views

org-mode: how can i point to python3.5 in my org-mode doc?

On: Aquamacs 3.3 GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109)) of 2016-09-19 in mac osx sierra I changed my ~/Library/Preferences/Aquamacs Emacs/...
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
0answers
7 views

How do I change the Python interpreter in Aquamacs 3.5 (based on GNU Emacs 25.3.50.1)?

I have been unable to get my Aquamacs 3.5 (built on Gnu Emacs 25.3.50.1) to run Python 3. I have put the following lines in both my Preferences.el (the Mac equivalent of .emacs) and within an ...
0
votes
1answer
28 views

Showing full (unabbreviated) Python output in Org Mode

The result of a certain Python (statsmodel module) code in org-mode is abbreviated: #+BEGIN_SRC python import pandas as pd import statsmodels.api as sm auto_df=pd.read_csv('Auto.csv', usecols= [...
0
votes
1answer
94 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
1answer
49 views

How to open org-mode table as a pandas dataframe (with column names)?

I can't find how to open an org-mode table as a pandas dataframe. Here is my example: #+NAME:tbl | a | b | |---|---| | 1 | 2 | #+BEGIN_SRC python :var tbl=electro :results replace output :session ...
2
votes
0answers
299 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 ...
0
votes
0answers
51 views

Why is Selenium / Chromedriver giving me errors in Emacs' Python shell?

If I launch a Python shell inside Emacs with run-python and try to open a Chromium window with Selenium, I am suddenly running in to the following error: Python 3.8.5 (default, Jan 27 2021, 15:41:15) ...
5
votes
2answers
1k views

hs-minor-mode with python.el - hide if statements, for/while loops, etc

Currently, I use the hs-minor-mode to collapse my python code and make it easier to work with - however, by default this only folds def my_function(): blocks. Is it possible to get it to work with if, ...
22
votes
2answers
12k views

Using conda environments in emacs

What is the best way to use conda environmets using emacs as a Python IDE? I have got different conda environments while programming in Python: $ conda info -e # conda environments: # django ...
3
votes
1answer
93 views

Unexpected indentation in python chunks

Already one year ago, I described a problem on github with polymode and unexpected indents. Since there was no answer there so far and the problem is really annoying, I ask here for ideas for a ...
0
votes
0answers
19 views

Report wrong Elpy-Behaviour, but to whom and how?

I'm using emacs to write my python-code and lately I found some wrong behaviour of one of the auto-format-features: Given this wrong code: def doStuff(self, s_database): return ("ASDF" @...
0
votes
0answers
15 views

How to fontify keyword arguments in `python-mode`?

I'm coding in python and it seems like the python-mode doesn't color the keyword-arguments. Note that I'm not talking about general keywords but keyword-arguments. As an example, in the next picture, ...
1
vote
2answers
217 views

Symbol's function definition is void: rx-let

Whenever I try to use elpy, or even just fontlock (with elpy disabled) in a python file, I get the error that rx-let is void. This is what I got from --debug-init: Debugger entered--Lisp error: (void-...
3
votes
2answers
67 views

Is it possible to suppress `Fill column set to 80 (was 80)` message in the echo area?

When I open a Python file I keep seeing Fill column set to 80 (was 80) message in the echo area. I know I have set it this limit , but I don't want to be keep reminded about it. Is it possible to ...
1
vote
2answers
148 views

Why is my Imenu not showing function and class definitions?

I feel like something is wrong with my Imenu setup, because here is what it shows on a simple Python script: It seems to show some variable definitions, but doesn't have separate entries for the ...
3
votes
1answer
31 views

Annoying “error in process filter: Overlapping strings detected”

When editing python code with elpy, if I type a single or double quote while writing a new line of code (i.e. adding or changing a line in existing code), the UI freezes momentarily, make the bell ...
0
votes
1answer
76 views

How can I jump back after `rope-goto-definition`?

I am using rope-goto-definition to jump into a module's definition, link. But I cannot jump back to where I was. xref-pop-marker-stack says Marker stack is empty. Is it possible to jump back after ...
2
votes
2answers
1k views

Autocomplete after dot in python

I haven't used emacs before, but would like to learn how to use it properly for Python development. From the past IDEs I have used I enjoyed the feature to obtain information on possible objects ...
1
vote
0answers
85 views

`lsp` does not start on python-mode-hook

I am using lsp under Python.lsp does not start when a Python file is opened, I have to do M-x lsp for each file I open. Also when I switch from find-file to another file I have to do M-x lsp all over ...
0
votes
0answers
10 views

Ipython as run-python binary, no tab complete

I've been using the standard python repl in emacs for a while and decided to change to use ipython with all of it's autocompletions and other features. Unfortunately, if I try using ipython in multi-...
1
vote
1answer
18 views

How do I get org-mode to treat the output of a non-latex code block as latex?

(Emacs: v27.1, Org: v9.5, pdfTeX: v3.14159265-2.6-1.40.21) I am using the following Python code block to print LaTeX code: #+BEGIN_SRC python :session :exports both :results output :wrap math ... #+...
0
votes
1answer
29 views

How do I open an inferior Python process in a full window from the command line?

From the command line, I want to open an inferior Python process in a full window. I have tried: emacs --eval '(run-python)', but when Emacs opens, the *scratch* buffer is shown instead of the ...
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
151 views

Updating pyenv when switching to a Python buffer

I use pyenv to maintain my python versions and virtualenvs. I really like the way you can create a local .python-version for each project, pointing to the version I need. I use pyenv-mode which allows ...
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 ...
0
votes
1answer
27 views

Repeating characters in `python-mode.el` shell interaction

I experience strange behaviour when using python-mode. When sending characters to the shell using C-c C-e, the first string works well. After that, the characters start repeating, in a manner that is ...
11
votes
3answers
3k views

Two Python modes

I have been trying to configure Emacs to use the proper Python mode. To this end I have read a few tutorials. Most importantly this one. The tutorial uses the python-mode package. However, when I ...
0
votes
0answers
87 views

mypy FileNotFoundError: [Errno 2] No such file or directory: '.mypy_cache/3.8/utils.data.json'

I keep having following warning message, even I have the recent version of python-mypy not sure why this warning message is generated; is there any way to fix this: Try installing a more recent ...

1
2 3 4 5
10