I have the same python project on 2 computers running osx and ubuntu 14.04
I am running a script in the phd_thesis.non_linear_features_selection
folder
At the beginning of the script I import some functions as:
import numpy as np
#from phd_thesis.non_linear_features_selection.example_datasets.polynomial_datasets import * # it works only on OSX
from example_datasets.polynomial_datasets import * # it works only on ubuntu
I have to use a different import path on osx and ubuntu. Why is this happening? How can I have a single import that works on both os?
EDIT: The project is a bit messy. Here the tree structure:
onbeo@donbeo-OptiPlex-790:~/Dropbox/pythoncode/phd_thesis/non_linear_features_selection$ tree
.
|-- checkpoint
|-- deep_learning
| |-- autoencoder_fsca.py
| |-- autoencoder_fsca.py~
| |-- autoencoder_j2m.py
| |-- autoencoder_j2m.py~
| |-- autoencoder_magic.ckpt
| |-- autoencoder_NC60.ckpt
| |-- autoencoder_parkinson.ckpt
| |-- checkpoint
| |-- mnist_autoencoder.ckpt
| |-- nn_j2m.py
| |-- nn_j2m.py~
| |-- nn_selector_magic_nino.py
| |-- nn_selector_magic_nino.py~
| `-- results
|-- elm_fsca_j2m.py
|-- elm_fsca_j2m.py~
|-- elm_fsca_poly_example.py
|-- elm_fsca_poly_example.py~
|-- elm_fsca_various_datasets.py
|-- elm_fsca_various_datasets.py~
|-- example_datasets
| |-- __init__.py
| |-- polynomial_datasets.py
| |-- polynomial_datasets.py~
| `-- __pycache__
| |-- __init__.cpython-34.pyc
| `-- polynomial_datasets.cpython-34.pyc
|-- examples_issc2016.py
|-- examples_issc2016.py~
|-- __init__.py
|-- j2m_results_plot.py
|-- j2m_results_plot.py~
|-- neural_network_lasso.py
|-- neural_network_lasso.py~
|-- non_linear_regression_examples_plot.py
|-- non_linear_regression_examples_plot.py~
|-- non_linear_regression_examples.py
|-- non_linear_regression_examples.py~
|-- non_linear_regression_simulated_data_tables.py
|-- non_linear_regression_simulated_data_tables.py~
|-- parity_function_example.py
|-- parity_function_example.py~
|-- polynomial_data_example.py
|-- polynomial_data_example.py~
|-- __pycache__
| `-- __init__.cpython-34.pyc
|-- real_data_example.py
`-- results
The script that I am running is |-- polynomial_data_example.py
(6th element from the bottom)
Copyright Notice:Content Author:「Donbeo」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/36432203/python-different-import-behaviour-on-osx-and-ubuntu