samba-tool ImportError: No module named param
Noel Power
nopower at suse.com
Wed Dec 12 16:35:23 UTC 2018
On 12/12/2018 16:08, Volker Lendecke wrote:
> On Wed, Dec 12, 2018 at 03:49:46PM +0000, Noel Power via samba-technical wrote:
>> the default make builds and installs python3 products, the import statement
>> if failing because you are running ./bin/samba-tool (which by default on
>> your system is running with python2 because of the shebang)
>>
>> if you run python3 ./bin/samba-tool it will work
>>
>> So, why haven't we changed the shebang to python3, there is currently some
>> discussion ongoing about that. It's not as clear cut as you think. In
>> general though scripts that are deliberately written to run with python2 &
>> python3 can have python in the shebang line. You need to be aware what
>> /usr/bin/python (or wherever it is located) is pointing at, in a system that
>> has python2 and python3 it might be /usr/bin/python could be a link to
>> either (and certainly in some newer enterprise focused distros I will bet
>> soon python -> python3), additionally you need to be aware of what your
>> build targets python2 or python3
> The python community really was smoking weird stuff when designing a
> completely new and incompatible language, naming it the same as the
> one before.
that's not quite true, the recommendation is new code should use a
shebang appropriate to the version that is targetted python2 or python3
(or even more finely grained python2.x or python3.x etc.) The exception
is code that is designed to work with both. /usr/bin/python in modern
systems is a placeholder (e.g. a link) the actual scripting interpreters
are python2 & python3 so it kindof makes sense to have the shebang names
as it is to reflect that.
>
> We must force the user to choose either python2 or python3 at build
> time and not even pretend to do anything else. If the default "python"
> is python2, just don't do any attempt to even use or build for
> python3.
well whoever is building needs to decide and it doesn't necessary depend
on what /usr/bin/python points at
> If "python" runs python3, do the reverse. No mix up. At all.
>
> We should make a blocker bug for 4.10. We can't ship with this mess.
it isn't as much of a mess as you think, the problem is that we probably
should be replacing the shebang on any python scripts (or tools) that
are delivered as part of the build (depending on which python version is
targetted). This is already something we are discussing but it is good
to get feedback. That's the purpose of getting in early into master so
we can iron these things out
Noel
More information about the samba-technical
mailing list