Re: [Tutor] Python 3.2 Install Not Responding To Python Command!!
I know this was a while ago but you can add the ppa by going to the terminal and typing: sudo add-apt-repository ppa:irie/python3.2 then sudo apt-get update and sudo apt-get install python3.2 Rohan On Sun, Apr 10, 2011 at 1:33 PM, Walter Prins wrote: > > > On 9 April 2011 19:45, Nevins Duret wrote: > >> I can't thank you enough for your help. Yes, I usually use the Synaptic >> Package Manager, however in this case, Python version 3.2 is not on the >> Synaptic package Manager. This is why I chose to build it from source. As >> far as what I think is causing this when I go in the >> > > No problem. > > >> Terminal and type: >> >> sudo update-alternatives --install /usr/bin/python/python3.2 python >> /opt/py32/bin/python3.2 1 >> >> I get this as an error message: >> >> update-alternatives: renaming python link from /usr/bin/python to >> /usr/bin/python/python3.2. >> update-alternatives: warning: forcing reinstallation of alternative >> /opt/py32/bin because link group python is broken. >> update-alternatives: error: unable to make >> /usr/bin/python/python3.2.dpkg-tmp a symlink to /etc/alternatives/python: No >> such file or directory >> > > I would expect that "update-alternatives" would have trouble (on the first > line) because /usr/bin/python is not a link anymore (but instead a folder) > based on your previous posts. > > So, please go and inspect the /usr/bin/python folder and see what if > anything's inside. If it's not empty you need to see what is in fact in it > and hopefully get rid of it or move it out of the way. Once it's empty, then > just delete the /usr/bin/python folder (you'll have to be root or use > "sudo") and afterwards either recreate a link to the default python > interpreter and/or try the update-alternatives command again. (To manually > restore the default python link, first execute "which python2.6" which > should output "/usr/bin/python2.6", then execute "sudo ln -s > /usr/bin/python2.6 /usr/bin/python" which should restore the link to the > default python. After doing this "update-alternatives" should have less > trouble redirecting the /usr/bin/python link. > > I however want to reiterate that your problems, especially fixing your OS, > will be better dealt with on the Ubuntu community forums. > > Rohan, thanks for posting about that PPA, wasn't aware of it! > > Walter > > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Pictures
On Wed, Apr 27, 2011 at 11:41 PM, wrote: > Hello, > > I'm still quite new at this but I'm trying to get a list of the pictures > adress (... .jpg) of a page of a website. > > I thought of using the import urllib and import re, trying to fetch the > website, parse it, and collect the adresses but I don't know how to do it... > > Can you help me? > > Thanks > Sent from my BlackBerry® on the MetroPCS Network > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > What have you tried? First try to learn how to read a web page. You are right to look into urlib and urlib2. Its only a handful of lines of code to open a web page and retrieve it to your system. Once you do that there is a package called beautiful soup that is a good tool to read through the tags in the page Let us know how you are doing. -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Pictures
On Thu, Apr 28, 2011 at 6:48 PM, Joel Goldstick wrote: > > > On Wed, Apr 27, 2011 at 11:41 PM, wrote: > >> Hello, >> >> I'm still quite new at this but I'm trying to get a list of the pictures >> adress (... .jpg) of a page of a website. >> >> I thought of using the import urllib and import re, trying to fetch the >> website, parse it, and collect the adresses but I don't know how to do it... >> >> Can you help me? >> >> may i know the url of that page? and give a try? > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Pictures
Observing the page source i think : page=urllib.urlopen('http://finance.blog.lemonde.fr').read() x=re.findall(r"http://s2.lemde.fr/image/2011/02/16/87x0/1480844_7_87fe_bandeau-lycee-electrique.jpg " x.extend(y) x=list(set(x)) for img in x: image=img.split('.')[-1] if image=='jpg': print img ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] distutils site.cfg variable expansion
I'm learning my way around package building using setuptools, and would like to have scripts for a system administration package installed under $(prefix)/sbin instead of under the default $(prefix)/bin directory without requiring the installer to use the manual 'python setup.py install --install-scripts=...'. I would like to have something in the setup.cfg file like this which would be handled by the normal ConfigParser expansion. Either I have the syntax wrong, or the setuptools/distutils configuration parsing is different. [global] prefix=/path/to/prefix [install] install-scripts=%(prefix)s/sbin Better yet would be for the prefix to be available from the command line or taken from sys.prefix if not specified. Is there a way to do this other than fiddling the site.cfg file? Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 Skype: jwccsllc (206) 855-5792 In a nation ruled by swine, all pigs are upwardly mobile. -- Hunter S. Thompson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Calling a python script using subprocess
I am trying to execute a python script using the subprocess module. I am feeding parameters into the script, which reads them using argparse and returns a list. The script simply returns a list when called. When I execute my script from my prompt, I get the following: H:\pythonscripts>installModule.pyc --mods mod1 mod2 mod3 ['mod1', 'mod2', 'mod3'] # This is the result I would like When I call the script from within another script using subprocess I get an error: p = subprocess.Popen(r'installModule.py --mods mod1 mod2 mod3', executable = sys.executable, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) 'Unknown option: --\r\n' 'usage: installModule.py [option] ... [-c cmd | -m mod | file | -] [arg] ...\r\n' Is the subprocess module the best thing for me to use? Is there a better way to call this script?___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Calling a python script using subprocess
On Fri, Apr 29, 2011 at 7:18 AM, GoodPotatoes wrote: > > p = subprocess.Popen(r'installModule.py --mods mod1 mod2 mod3', executable = > sys.executable, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) Try this (untested): p = subprocess.Popen(["/usr/bin/env python", "installModule.py", "--mods", "mod1", "mod2", "mod3"], stdout = subprocess.PIPE, stderr = subprocess.STDOUT) cheers James -- -- James Mills -- -- "Problems are solved by method" ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor