You are not logged in.
Hi,
pygtk has not been working (and never has), and I've looked at and tried solutions in other threads, but none have fixed my problem.
This is what I did:
$ python
Python 3.3.2 (default, Sep 6 2013, 09:35:59)
[GCC 4.8.1 20130725 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pygtk'
>>> I've tried uninstalling pygtk, pygobject, and pycairo, and then reinstalling pygobject, pycairo, then pygtk, as suggested in other threads.
Thank you for any help,
dluco
Last edited by dluco (2013-09-27 03:58:37)
Offline
pygtk is for python2, not python3.
Offline
Got it. Running
$ python2
>>>import pygtkworks just fine.
The reason I was trying to get pygtk to work is because I have a script that needs pygtk. The script starts with
#!/usr/bin/env pythonWould changing the header to "python2" work?
Thanks
Offline
Depends on the script. If it's using pygtk, it most likely is targeting python2 in the first place, so yes, just change "python" to "python2" in the shebang and you should be fine.
Last edited by Scimmia (2013-09-26 22:36:16)
Offline
Got it. Running
$ python2 >>>import pygtkworks just fine.
The reason I was trying to get pygtk to work is because I have a script that needs pygtk. The script starts with
#!/usr/bin/env pythonWould changing the header to "python2" work?
Thanks
Almost certainly. If you want to try it first, launch the script by placing python2 in from of the name, in other words:
ewaller$@$odin ~/devel/python 1008 %./hello uptime
File "./hello", line 11
print "Content-type: text/html"
^
SyntaxError: invalid syntax
ewaller$@$odin ~/devel/python [1]1009 %python2 hello uptime
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title> It's my party</title>
</head>
<body>
<h3>The passed parameters are:</h3>
<br>hello
<br>uptime
<p><h2>Here is the output from the linux command uptime</h2><p>
<pre>
15:36:00 up 2 days, 18:08, 2 users, load average: 0.12, 0.20, 0.22 </pre>
</body>
</html>
ewaller$@$odin ~/devel/python 1010 %BTW, do not ever leave a script like this laying around on a Django server ![]()
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Awesome, works like a charm now. Thanks!
For the record, the problem of pygtk not working was due to the fact that python3 was being used instead of python2.
Going slightly off topic, I was wondering how the majority of arch-users shutdown/reboot their comps. Right now I use
sudo poweroffwhich gets tedious after awhile (like now).
To make my life easier, I planned on using a logout script written in python that I use in crunchbang. However, I ran into the pygtk problem (above), and now I have the problem that the script can't successfully logout due to org.freedesktop.ConsoleKit not being provided by any .service files.
I'm sorry if this is too off-topic, and I'll definitely mark this thread as solved in any case.
Offline
If it's too much typing, why not use an alias like
alias H="systemctl poweroff"Offline
Exactly what I was looking for! Thanks!
Marking tread as solved.
Offline