workaround is to use sys.path.append

thanks
Jay

On Tuesday, May 8, 2018 at 8:17:53 PM UTC-5, Laurent Desmet wrote:
>
> Hi everyone,
>
> I want to try to import a .py,  "Usefull function.py", which contain some 
> function I want to apply. The thing is, this file is located from another 
> folder. Here is my code :
>
>
> from __future__ import print_function
>
> import keras
> from keras.models import Sequential
> from keras.layers import Dense, Dropout
> from keras.optimizers import RMSprop
> from matplotlib.patches import Rectangle
> import timeit
> import numpy as np
> from matplotlib import pyplot as plt
> from sklearn.datasets import load_iris
> import sys
> *sys.path.insert(0, 'C:/Users/Laurent/Desktop/travail EPM')*
> *from Usefull_function import **
>
> Basically I have this output :
>
> ModuleNotFoundError: No module named 'Usefull_function'
>
>
> I don't get why, I can guarantee the file "Usefull function.py" is in this 
> folder * 'C:/Users/Laurent/Desktop/travail EPM'* but for a resaon, 
> doesn't find it.
> By the way, when I click on "run" the explorer always returns to the 
> folder where the file I'm running.
>
> If someone could help me, I would be very gratefull !
>
> Thank's everyone !
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to