Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93720

Re: Fwd: Python Error: ImportError: No module named ''folder_name’ at Command Prompt

Return-Path <vincent.vande.vyvre@telenet.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'subject:Error': 0.07; 'subject:module': 0.09; 'python': 0.10; '__init__.py': 0.16; 'examples:': 0.16; 'folder,': 0.16; 'from:name:vincent vande vyvre': 0.16; 'received:195.130': 0.16; 'received:195.130.137': 0.16; 'received:telenet-ops.be': 0.16; 'subject:\x92 ': 0.16; '\xe9crit': 0.16; 'skip:" 30': 0.20; 'skip:" 40': 0.20; 'init': 0.22; 'ph.d.': 0.22; 'help.': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'work.': 0.30; 'folder': 0.30; 'received:be': 0.30; 'foo': 0.33; 'file': 0.34; 'add': 0.34; 'could': 0.35; 'skip:s 60': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'skip:s 50': 0.37; 'to:addr:python.org': 0.40; 'your': 0.60; 'hope': 0.61; 'charset:windows-1252': 0.62; 'header:Reply-To:1': 0.67; 'link:': 0.69; 'reply-to:no real name:2**0': 0.71; 'as:': 0.79
Date Sun, 12 Jul 2015 07:50:57 +0200
From Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be>
Reply-To vincent.vandevyvre@oqapy.eu
User-Agent Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Fwd: Python Error: ImportError: No module named ''folder_name’ at Command Prompt
References <CANutusz_o3cQNfoDDqgV=K8fai44rAL6QyCk3z8NC3FRRPNQdg@mail.gmail.com> <mnsarg$mg7$1@ger.gmane.org> <CANutusy8V0s2TLeXA-5S03qmOjtb0Qd7TruTz_U_Yf42JfacMQ@mail.gmail.com> <55A1E620.7070507@udel.edu> <CANutuswvnXt-cuMJhF+QKwmVL4C9VP5Rk71-nmL-PwbnkVH0PA@mail.gmail.com>
In-Reply-To <CANutuswvnXt-cuMJhF+QKwmVL4C9VP5Rk71-nmL-PwbnkVH0PA@mail.gmail.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.444.1436680979.3674.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436680979 news.xs4all.nl 2868 [2001:888:2000:d::a6]:55526
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4359
X-Received-Body-CRC 3376587105
Path csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:93720

Show key headers only | View raw


Le 12/07/2015 06:02, Ernest Bonat, Ph.D. a écrit :
> Thanks for your help. I had follow the link: How to add a Python module
> to syspath?
>
> <http://askubuntu.com/questions/470982/how-to-add-a-python-module-to-syspath>
> and I could not make it work. I did use sys.path.insert() and
> sys.path.append() as:
>
> Examples: sys.path.append('/python_mvc_calculator/calculator/') or
> sys.path.insert(0, "/python_mvc_calculator/calculator")
>
> I did try it to:
> sys.path.append('/python_mvc_calculator/calculator/controller') or
> sys.path.insert(0, "/python_mvc_calculator/calculator/controller") too!
>
> The main.py file is in python_mvc_calculator/calculator folder and I
> need to import a module calculatorcontroller.py in
> "python_mvc_calculator/calculator/controller"
>
> I hope this explanation helps a bit!
>
> <http://askubuntu.com/questions/470982/how-to-add-a-python-module-to-syspath>
>
> Thanks
>

If "/python_mvc_calculator/calculator/controller" is a folder and if you 
have a file __init__.py into this folder, you have to use:

sys.path.insert(0, "/python_mvc_calculator/calculator/controller")
from calculatorcontroller import foo # or import calculatorcontroller

But the init file must be named __init__.py NOT init.py as sayed in 
askubuntu.

Vincent

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fwd: Python Error: ImportError: No module named ''folder_name’ at Command Prompt Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2015-07-12 07:50 +0200

csiph-web