1

What is happening under the hood when we type :w !python3 in VIM. Does it invoke the system-wide python3 or the one present in the virtual environment?

My script:

import sys
sys.path.append('./extnsn/')

This appends the ./extnsn/ directory to the sys.path variable. However, I am prompted with module extnsn not found error.

The error is the same when executing the script with python-mode enabled.

Having tough time importing a module from another directory. Any help is much appreciated.

2
  • Does your question contain a typo: ...system-wide python3 or the one present.... Your question is basically incomplete: someone else cannot reproduce your error module extnsn not found with the given script. It misses the line import extnsn and you could add an empty python module extnsn to easily setup a project to reproduce your problem. Also you indicate that you use a virtual environment: however, you missed to describe this and how the situation on the command line is. Tools which help to describe your project layout and env. are $ tree and $ env showing relevant output.
    – Hotschke
    Aug 23 '18 at 9:05
  • Typo corrected @Hotschke. The problem was, the parent directory from which I was executing the script. After setting the correct parent directory with NERDTree the issue vanished.
    – Bussller
    Sep 2 '18 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.