EvilZone

General Tech => Operating System => : Kulverstukas October 05, 2012, 08:14:21 PM

: Ubuntu 10.04 trouble
: Kulverstukas October 05, 2012, 08:14:21 PM
After an update earlier today something went wrong with the Python installation. I saw that in the update manager window there was some python 2.6 updates. This hasn't happened before.
My main issue is that WICD network manager is not working, because Python cannot import urandom.
:
kulverstukas@kulvertop:~$ wicd
Traceback (most recent call last):
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 57, in <module>
    from wicd import networking
  File "/usr/lib/pymodules/python2.6/wicd/networking.py", line 53, in <module>
    import misc
  File "/usr/lib/pymodules/python2.6/wicd/misc.py", line 35, in <module>
    from pipes import quote
  File "/usr/lib/python2.6/pipes.py", line 64, in <module>
    import tempfile
  File "/usr/lib/python2.6/tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "/usr/lib/python2.6/random.py", line 47, in <module>
ImportError: cannot import name urandom

This is easily solvable as I saw many times on google with a tool called virtualenv by creating a new virtual environment (whatever that is...), but I don't seem to have that tool installed for some reason, and I cannot install it because my network manager does not start (no wireless or wired connection).

So question: how do I fix this issue with or without virtualenv...?
: Re: Ubuntu 10.04 trouble
: s3my0n October 05, 2012, 10:03:37 PM
Either fix your network manager or download virtualenv from the computer you are currently posting this post from and copy it over to the 'buntu machine :)
: Re: Ubuntu 10.04 trouble
: Kulverstukas October 06, 2012, 01:24:05 PM
To fix WICD I need to fix python itself. I tried running virtualenv, and it's a god damn python script itself, and guess what:
:
kulverstukas@kulvertop:~/Desktop$ python virtualenv.py
Traceback (most recent call last):
  File "virtualenv.py", line 18, in <module>
    import tempfile
  File "/usr/lib/python2.6/tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "/usr/lib/python2.6/random.py", line 47, in <module>
ImportError: cannot import name urandom
am I fucked at this point? :P
: Re: Ubuntu 10.04 trouble
: s3my0n October 06, 2012, 01:36:17 PM
Why do you have to use WICD to connect to wireless? You can do it with iwconfig.
:
http://blog.tplus1.com/index.php/2008/06/13/how-to-connect-to-a-wireless-network-from-the-ubuntu-command-line/
: Re: Ubuntu 10.04 trouble
: RedBullAddicted October 06, 2012, 03:11:32 PM
Or you connect to your router with a network cable. If you don't use dhcp you can run the following commands:

:
ifconfig <your network interface (eth0)> <ip you want to use (192.168.1.10)> netmask <your subnet mask (255.255.255.0)>
route add default gw <your router ip (192.168.1.1)>
echo nameserver <your router ip (192.168.1.1)> > /etc/resolv.conf

if you use dhcp you should get your settings automatically. to force it you can run
:
dhclient -r
dhclient

to verify if everything works as expected try ping www.google.com (http://www.google.com)

if your connection is working you can try to reinstall python with aptitude install python

Maybe this helps... not sure but it is worth a try.

Btw. as you are on ubuntu you will need sudo in front of all commands.
: Re: Ubuntu 10.04 trouble
: Kulverstukas October 06, 2012, 04:38:16 PM
Thanks for the help guys, but I managed to solve it quite easily today. It wasn't related to virtualenv at all.
I noticed that everything is ran with the command "python", which doesn't work, but when I run a python script with a command "python2.6" which is the same python executable but with different name, it works. So I did "sudo cp /usr/bin/python2.6 /usr/bin/python" and it started to work again.

Weird issue, my guess is that after an update the main executable (./python) got corrupt somehow maybe... well, it seems to work now :P
: Re: Ubuntu 10.04 trouble
: s3my0n October 06, 2012, 10:19:08 PM
I think python was updated to some new version, so you've just overwritten it :P
But usually /us/bin/python is a symlink, so the original version is still intact. Have a look at 'ls -la /usr/bin | grep python'