Windows Python v. Linux Python: "from module import *" is not importing on Windows -
having think unusual problem. have python script script1.py defining class baseclass(dict), , script defining class childclass(baseclass).
childclass import first script from script1 import *, when trying run childclass nameerror: name 'baseclass' not defined.
# script1.py ... class baseclass(dict): def __init__(self, params): pass ... # childclass.py script1 import * class childclass(baseclass): ... the exact same scripts run fine on home machine (ubuntu 15.04), work machine (windows 7 pro) i'm getting aforementioned nameerror.
i've checked in python environment, , indeed finding script1.py file, not importing of functions inside.
>>> script1 import * >>> baseclass traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'baseclass' not defined' i'm imagining problem difference between windows python , linux python, i've never had kind of problem before. insight welcome.
turns out (hypothetically named) script1 shares name built-in python module. looks error wasn't occurring on home machine because i'm running python 3 there , 2 on work machine.
to solve this, i've re-named script1.
Comments
Post a Comment