I read some articles about Vimscripting with python. I felt very interested. So I tried to figure out how to do vimscripting with python.
But when I tried to import vim, it showed that the module vim wasn't installed. So I searched
on the web, but still haven't find the module to install.
I also tried pip to search automatically, still failed.
Does anyone know where to find the module vim?
I am using fedora 17, and I have installed vim 7.3 and python 2.7.
Thanks in advance.
Here is the error message:
>>> import vim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named vim
It doesn't seem like you need to import it, just make sure your vim is compiled with python support. Check this using vim --version | grep +python. Further, it seems that the vim module is imported automatically when in vim, rendering your import line unnecessary.
it do not work but this will work
:python from vim import *
:python command('echo "Hello World!"')
if you put vim.command(..
You get
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'vim' is not defined
Compile VI with python as described by hd1. You can find the documentation here:
http://vimdoc.sourceforge.net/htmldoc/if_pyth.html
If you want to test
export PYTHONPATH=$HOME/local/lib/python2.7/site-packages
Note that I installed all in local, this is why I use $HOME in PYTHONPATH
Run vi then, type
:python from vim import *
:python vim.command('echo "Hello World!"')
you should see "Hello World!" below.
Related
When I try to use installed packages in Python, I nearly always run into the same error.
So I e.g. install a package like this: pip3 install mathplot and when I afterwards want to use it in Python3 (I use python3 in the command prompt), I run into the ModuleNotFoundError:
>>> import mathplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mathplot'
But when I run just python, the module is found and ready to use.
Any idea where this problem comes from and how I can get rid of it?
Thanks in advance
I am trying to install the following package in my MacOS High Sierra 10.13.6:
https://github.com/Michalychforever/CLASS-PT
When i run the make file everything looks to work fine. It not only generate an executable, which i can run by terminal using the ./ command, but also a python wrapper. The problem is related only with the former.
When i try to import the library i get the following message:
import classy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so, 2): Symbol not found: _zdotu_
Referenced from: /Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so
Expected in: flat namespace
in /Users/thiagomergulhao/Library/Python/2.7/lib/python/site-packages/classy.so
I am using the built-in python version (i.e 2.7.10). I already installed the Xcode 10.1 together with command line commands. My .bash_profile is:
export PATH="/Users/thiagomergulhao/Library/Python/2.7/bin:$PATH"
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Does anyone have any ideia what is causing this problem?
Emacs 24.5
Python 2.7.12
If I start simple (Hello world) python script from shell - is OK. But if start more difficult script then return error:
python myscript.py "some_params"
ATTENTION! https://pypi.python.org/pypi/names/ package is requred to randgen human names.
Run "sudo pip install names" to install.
Traceback (most recent call last):
File "myscript.py", line 6, in <module>
import secretary
File "my_another_script.py", line 5, in <module>
import names
ImportError: No module named names
You need to install the external libraries you are using. names in this case is an external library that you need to install to make your script work.
I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.
Somehow my python is broken and emits the error:
jseidel#EDP15:/etc/default$ python -c 'import random'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.6/random.py", line 47, in <module>
from os import urandom as _urandom
ImportError: cannot import name urandom
This is NOT the virtualenv error that is so commonly documented here and elsewhere: I don't use python directly, I have never setup a virtualenv explicitly, and there is no virtualenv directory or python script that I can find anywhere on my system.
I'm running Kubuntu 10.04 and until just recently my KPackageKit worked just fine and handled updates with no problem. Now it shows nothing... maybe because of this python error, maybe because of something else.
How do I go about finding the error and fixing python?
As suggested by #Armin Rigo, this worked for me:
1) Add a print 42 at the end of the /usr/lib/python2.6/os.py file.
2) If you see "42", then that is the correct os.py file and the urandom module is not include. Add the statement to include urandom (you can find a sample from another os.py file). This was what worked for me.
3) If you don't see "42", then that's not the os.py file that you're using. Find the random.py file that is crashing and insert import os; print os.__file__ to get more information about the failure.