Re: meld/pygtk on solaris



On Sun, Jun 8, 2008 at 10:39 PM, Gareth <redgreenandpotatoe yahoo co uk> wrote:
>> Are the quotes really in the file?  If so, it's not valid python.  If
>> not, you may not be running it with python
>>
>> Try this
>>
>> /opt/csw/bin/python /opt/csw/bin/meld
>>

My comment was made too quickly.  What I really should have said is
that the feedback you're getting (the errors) from running meld do not
look like python errors: that leads me to believe your bang line is
wrong.

> This is directly cut and pasted from the meld file did you mean the quotes
> here:
>
> if "--pychecker" in sys.argv:
>    sys.argv.remove("--pychecker")
>    import os
>    os.environ['PYCHECKER'] = "--no-argsused --no-classattr --stdlib"
>
> When I run /opt/csw/bin/python /opt/csw/bin/meld I just get the old message
>
> bash-3.00$ /opt/csw/bin/python /opt/csw/bin/meld
> No module named pygtk
> Meld requires pygtk2.6.0 or higher.
>

So, you _must_ install pygtk for _this_ version of Python before you
can use it to run any python scripts that require it.

> In the bang line I changed it to this
>
> #! /opt/csw/bin python
>
> What I was trying to do was just copy the existing line and just
> change the path.

Even if you fix this, by replacing the space with /, it still will not
run because that version of python does not have PyGTK installed.

As I tried to explain (unsuccessfully I guess), most python scripts
are set up to run "/usr/bin/env" with an argument of python (which
then runs python).  In your bang line, the shell will try to run
"/opt/csw/bin" with an argument of "python".  This is not what you
want.

However, you can skip that and run any executable (including python),
directly.  So you just need

#!/path/to/python/with/gtk/python

Which means that "/path/to/python/with/gtk/python" must exist and be a
python interpreter.

You should be able to take everything after the #! and run it at a
shell prompt.  If it does not run the interpreter you want (in your
case Python), then it's not correct.

In summary, if you can't run the meld script directly using your
python interpreter, then putting that into the bang line of the script
will not change anything

if I have and file /usr/local/bin/myscript, with contents:
#!/path/to/somewhere/interp
#
# This is a ficticious script
....  rest of the srcipt ...

Then
$ /usr/local/bin/myscript
and
$ /path/to/somewhere/interp /usr/local/bin/myscript
are equivalent: they both run the script at '/usr/local/bin/myscript'
using the interpreter at /path/to/somewhere/interp'.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]