<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community</title>
		<link>http://www.daniweb.com/forums/</link>
		<description>Tech support, programming, web development, and internet marketing community. Forums to get free computer help and support.</description>
		<language>en-US</language>
		<lastBuildDate>Mon, 30 Nov 2009 11:56:23 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>Easiest way to load images in wxPython?</title>
			<link>http://www.daniweb.com/forums/thread240669.html</link>
			<pubDate>Mon, 23 Nov 2009 10:59:21 GMT</pubDate>
			<description>Hey All, 
 
I am working on a Java project for school. To make my project better, I wanted to integrate Python into it... like what I wanted to do is: 
* You run the Python program 
* You get two options: 
*     a) View source code 
*     b) View output 
* (Output is a recorded video) 
* User...</description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
I am working on a Java project for school. To make my project better, I wanted to integrate Python into it... like what I wanted to do is:<ul><li>You run the Python program</li>
<li>You get two options:</li>
<li>    a) View source code</li>
<li>    b) View output</li>
<li>(Output is a recorded video)</li>
<li>User selects any of the two</li>
</ul><br />
So here's the code:<br />
 <pre style="margin:20px; line-height:13px">import wx<br />
<br />
window=wx.App()<br />
<br />
class project(wx.Frame):<br />
&nbsp; &nbsp; def __init__(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.Frame.__init__(self, None, -1, &quot;Sravan's Java Project&quot;,size=(500,500))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.panel=wx.Panel(self, -1)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel, -1, &quot;Welcome to Sravan's Java Project.&quot;, pos=(10,10)).SetForegroundColour('red')<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel, -1, &quot;You can:&quot;,pos=(10,40))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.Button(self.panel,101,&quot;View source code&quot;,pos=(70,100))<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_BUTTON,self.sc,id=101)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.Button(self.panel,102,&quot;View output&quot;,pos=(70,160))<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_BUTTON,self.op,id=102)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Show()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Centre()<br />
<br />
&nbsp; &nbsp; def sc(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.MessageBox(&quot;Hi&quot;)<br />
<br />
&nbsp; &nbsp; def op(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.MessageBox(&quot;Bye&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
project=project()<br />
window.MainLoop()<br />
<br />
# For now, the functions don't actually do anything,<br />
# but I'll fix that later</pre><br />
My question is, I want to put two images of Blue J and WMP at (10,100) and (10,160) respectively. I just wanted to know how to do it...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240669.html</guid>
		</item>
		<item>
			<title>Need some advice on my topic for Java project...</title>
			<link>http://www.daniweb.com/forums/thread235637.html</link>
			<pubDate>Tue, 03 Nov 2009 11:33:04 GMT</pubDate>
			<description>Hey All, 
 
I have been asked to do a project on Java at school. We are still learning it at an elementary level... 
 
Many decided to do the project on things like ticket booking, banking and stuff... whereas I wanted to do something innovative and so decided that my topic would be on converting...</description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
I have been asked to do a project on Java at school. We are still learning it at an elementary level...<br />
<br />
Many decided to do the project on things like ticket booking, banking and stuff... whereas I wanted to do something innovative and so decided that my topic would be on converting some simple Java source code to Python source code...<br />
<br />
I need some advice on whether it is is feasible or not...<br />
<br />
Cheers</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum6.html"><![CDATA[Geeks' Lounge]]></category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235637.html</guid>
		</item>
		<item>
			<title>wxPython text overwrite problem...</title>
			<link>http://www.daniweb.com/forums/thread233909.html</link>
			<pubDate>Tue, 27 Oct 2009 16:10:59 GMT</pubDate>
			<description>Hey All, 
 
I have some code here, the problem is in line 82-83: 
 
import smtplib 
import wx 
 
window=wx.App() 
 
class pymailer(wx.Frame):</description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
I have some code here, the problem is in line 82-83:<br />
 <pre style="margin:20px; line-height:13px">import smtplib<br />
import wx<br />
<br />
window=wx.App()<br />
<br />
class pymailer(wx.Frame):<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; def __init__(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.Frame.__init__(self,None,-1,&quot;Py-mailer&quot;,size=(500,700))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.s=smtplib.SMTP(&quot;smtp.gmail.com&quot;,587)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.s.starttls()<br />
&nbsp; &nbsp; &nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wx.MessageBox(&quot;Error 001: Could not connect to the internet, please try again later.&quot;,&quot;Internet Connection Error&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.panel=wx.Panel(self,-1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; menubar=wx.MenuBar()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; filem=wx.Menu()<br />
&nbsp; &nbsp; &nbsp; &nbsp; filem.Append(201,&quot;Quit&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_MENU,self.Quit,id=201)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; viewm=wx.Menu()<br />
&nbsp; &nbsp; &nbsp; &nbsp; viewm.Append(202,&quot;About&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_MENU,self.About,id=202)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; menubar.Append(filem,&quot;File&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; menubar.Append(viewm,&quot;Help&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.SetMenuBar(menubar)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Welcome to Py-mailer.\n\nLogin with your Gmail credentials and you can send a text-only email to anyone quickly and easily.&quot;,pos=(10,10))<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Please enter your Gmail login ID: &quot;,pos=(10,100))<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Please enter your Gmail login password:\n(will not be stored)&quot;,pos=(10,130))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.username=wx.TextCtrl(self.panel,101,&quot;Login ID&quot;,pos=(220,100))&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.password=wx.TextCtrl(self.panel,102,&quot;Password&quot;,style=(wx.TE_PASSWORD),pos=(220,130))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; login=wx.Button(self.panel,103,label=&quot;Login&quot;,pos=(10,170))<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_BUTTON,self.Login,id=103)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;To:&quot;,pos=(10,250))<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Subject:&quot;,pos=(10,280))<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Message:&quot;,pos=(10,310))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.to_info=wx.TextCtrl(self.panel,104,pos=(80,250),size=(240,20))&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.sub_info=wx.TextCtrl(self.panel,105,pos=(80,280),size=(240,20))&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.msg_info=wx.TextCtrl(self.panel,106,pos=(80,310),size=(240,150))<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; send=wx.Button(self.panel,107,&quot;Send&quot;,pos=(245,470))<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_BUTTON,self.Send,id=107)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Centre()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Show()<br />
<br />
&nbsp; &nbsp; def Quit(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Close()<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; def About(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; about=wx.AboutDialogInfo()<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; about.SetName(&quot;Py-Mailer&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; about.SetCopyright(&quot;(c) 2009 Sravan&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; about.SetWebSite(&quot;http://www.uberpix.wordpress.com&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; about.AddDeveloper(&quot;Sravan&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; about.AddDeveloper(&quot;Daniel Pacheco&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.AboutBox(about)<br />
<br />
&nbsp; &nbsp; def Login(self,event):<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.user=self.username.GetValue()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.passw=self.password.GetValue()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(self.user==&quot;&quot; and self.passw==&quot;&quot;):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wx.MessageBox(&quot;Error 002: You did not enter your username and/or password&quot;,&quot;Enter Login Details&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.s.login(self.user,self.passw)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Logged in...&quot;,pos=(10,200))<br />
&nbsp; &nbsp; &nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Failed&quot;,pos=(10,200))<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; def Send(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.to=self.to_info.GetValue()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.subject=self.sub_info.GetValue()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.message=self.msg_info.GetValue()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.msg=&quot;To: &quot;+self.to+&quot;\nSubject: &quot;+self.subject+&quot;\n&quot;+self.message<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.s.sendmail(self.user,self.to,self.msg)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.s.quit()&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(self.panel,-1,&quot;Your message has been sent!&quot;,pos=(175,500))&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
pymailer()<br />
window.MainLoop()</pre>- because once I login successfully, if I again login with wrong details, the &quot;Failed&quot; text doesn't overwrite the &quot;Logged in...&quot; text fully.... so what do I do?<br />
<br />
Thanks a load</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233909.html</guid>
		</item>
		<item>
			<title>Converting wxPython files to .exe</title>
			<link>http://www.daniweb.com/forums/thread233445.html</link>
			<pubDate>Mon, 26 Oct 2009 11:58:54 GMT</pubDate>
			<description><![CDATA[Hey All, 
 
I have made a program called "Pymailer", I have even made a GUI version... now what I want to do is to convert it to .exe format... how do I do it? I googled for some info, but in vain!]]></description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
I have made a program called &quot;Pymailer&quot;, I have even made a GUI version... now what I want to do is to convert it to .exe format... how do I do it? I googled for some info, but in vain!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233445.html</guid>
		</item>
		<item>
			<title>wxPython, how to retrieve numbers?</title>
			<link>http://www.daniweb.com/forums/thread228867.html</link>
			<pubDate>Fri, 09 Oct 2009 13:24:31 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I was just making a tiny program, where I need the user to enter numbers. My question is, how do get numbers? 
 
I tried: 
 
self.panel=wx.Panel(None,-1) 
self.n=wx.TextCtrl(self.panel,-1,"Number") 
self.get=int(self.n.GetValue())]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I was just making a tiny program, where I need the user to enter numbers. My question is, how do get numbers?<br />
<br />
I tried:<br />
 <pre style="margin:20px; line-height:13px">self.panel=wx.Panel(None,-1)<br />
self.n=wx.TextCtrl(self.panel,-1,&quot;Number&quot;)<br />
self.get=int(self.n.GetValue())</pre><br />
-but that didn't work... so how do I do it?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228867.html</guid>
		</item>
		<item>
			<title>wxPython Events help</title>
			<link>http://www.daniweb.com/forums/thread224869.html</link>
			<pubDate>Tue, 22 Sep 2009 14:50:19 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I have made a small program called 'Py-mailer' which allows you to login with your Gmail credentials and send text-only messages to anyone. I uploaded it on SourceForge( http://www.tinyurl.com/m4ans4). 
 
The next step I had to take was to make a GUI for it. So, I started with...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I have made a small program called 'Py-mailer' which allows you to login with your Gmail credentials and send text-only messages to anyone. I uploaded it on SourceForge( <a rel="nofollow" class="t" href="http://www.tinyurl.com/m4ans4" target="_blank">http://www.tinyurl.com/m4ans4</a>).<br />
<br />
The next step I had to take was to make a GUI for it. So, I started with wxPython:<br />
 <pre style="margin:20px; line-height:13px">import wx<br />
<br />
window=wx.App()<br />
<br />
class pymailer(wx.Frame):<br />
&nbsp; &nbsp; def __init__(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.Frame.__init__(self,None,-1,&quot;Pymailer&quot;,size=(500,500))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; panel=wx.Panel(self,-1)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; menu=wx.MenuBar()<br />
&nbsp; &nbsp; &nbsp; &nbsp; items=wx.Menu()<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; items.Append(201,&quot;Quit&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Bind(wx.EVT_LEFT_DOWN,self.Quit,id=201)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; menu.Append(items,&quot;File&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.SetMenuBar(menu)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(panel,-1,&quot;Please enter your Gmail login ID: &quot;,pos=(10,10))<br />
&nbsp; &nbsp; &nbsp; &nbsp; wx.StaticText(panel,-1,&quot;Please enter your Gmail login password:\n(will not be stored)&quot;,pos=(10,40))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; username=wx.TextCtrl(panel,101,&quot;Login ID&quot;,pos=(220,10))<br />
&nbsp; &nbsp; &nbsp; &nbsp; password=wx.TextCtrl(panel,102,&quot;Password&quot;,pos=(220,40))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Centre()<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Show()<br />
<br />
&nbsp; &nbsp; def Quit(self,event):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.Close()&nbsp; &nbsp; <br />
<br />
pymailer()<br />
window.MainLoop()</pre><br />
But, on clicking 'Quit' in the 'File' menu, nothing happens! I think it is because in line 29, I have not passed the ID of the event, so how do I pass the ID? Or, is because of some thing else?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread224869.html</guid>
		</item>
		<item>
			<title>Program abruptly quits</title>
			<link>http://www.daniweb.com/forums/thread222550.html</link>
			<pubDate>Sat, 12 Sep 2009 17:07:06 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I have made a program called 'tLapse', here's the code: 
 
import subprocess 
import time 
import os 
 
print("Welcome to tLapse...") 
time.sleep(3)]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I have made a program called 'tLapse', here's the code:<br />
 <pre style="margin:20px; line-height:13px">import subprocess<br />
import time<br />
import os<br />
<br />
print(&quot;Welcome to tLapse...&quot;)<br />
time.sleep(3)<br />
os.system('cls')<br />
<br />
try:<br />
&nbsp; &nbsp; com=open(&quot;action.txt&quot;,'r').read()<br />
&nbsp; &nbsp; condition=True<br />
except:<br />
&nbsp; &nbsp; print(&quot;File error&quot;)<br />
&nbsp; &nbsp; raw_input(&quot;&lt;Any key to quit&gt;&quot;)<br />
&nbsp; &nbsp; condition=False<br />
<br />
if(condition):<br />
&nbsp; &nbsp; clock=raw_input(&quot;Enter time duration after which\nuser-specifiedaction will be\npeformed.\n\nFormat- &#91;hh:mm&#93;&#91;24- hour format&#93;: &quot;)<br />
<br />
def app(path):<br />
&nbsp; &nbsp; ext=path&#91;-3:&#93;<br />
&nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(ext=='exe'):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subprocess.call(&#91;path&#93;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif(ext=='mp3'):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subprocess.call(&#91;&quot;C:\Program Files\Windows Media Player\wmplayer.exe&quot;,path&#93;)<br />
&nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;Unexpected error occured&quot;)<br />
&nbsp; &nbsp; raw_input(&quot;&lt;Any key to quit&gt;&quot;)<br />
<br />
def shutdown():<br />
&nbsp; &nbsp; os.system(&quot;shutdows -s&quot;)<br />
&nbsp; &nbsp; <br />
def determine(com):<br />
&nbsp; &nbsp; for x in com:<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(x==' '):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ind=com.index(x)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type=com&#91;:ind&#93;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path=com&#91;ind+1:&#93;<br />
&nbsp; &nbsp; if(type=='open'):<br />
&nbsp; &nbsp; &nbsp; &nbsp; return path<br />
&nbsp; &nbsp; elif(type=='shutdown'):<br />
&nbsp; &nbsp; &nbsp; &nbsp; shutdown()<br />
<br />
path=determine(com)<br />
<br />
if(condition):<br />
&nbsp; &nbsp; print(&quot;Waiting till &quot;+clock+&quot;...&quot;)<br />
&nbsp; &nbsp; while(clock!=str(time.asctime()&#91;11:16&#93;)):<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(clock==str(time.asctime()&#91;11:16&#93;)):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; os.system('cls')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; app(path)</pre><br />
What it does is, it basically asks at what time the specified action has to be performed(action specified in 'action.txt' file).<br />
<br />
But the problem is, even though I give thoroughly valid commands, it abruptly quits without reporting any errors, and sometimes it magically works(like, after running it a few dozen times with the same commands specified in the .txt file).<br />
<br />
Any idea why?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread222550.html</guid>
		</item>
		<item>
			<title>Getting variables from other functions</title>
			<link>http://www.daniweb.com/forums/thread221447.html</link>
			<pubDate>Tue, 08 Sep 2009 12:23:42 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I have some code: 
 
import urllib2 as url 
import subprocess 
import os 
 
webs=open("url.txt",'r') 
read_webs=webs.read()]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I have some code:<br />
 <pre style="margin:20px; line-height:13px">import urllib2 as url<br />
import subprocess<br />
import os<br />
<br />
webs=open(&quot;url.txt&quot;,'r')<br />
read_webs=webs.read()<br />
<br />
def get_html():<br />
&nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; req=url.urlopen(read_webs)<br />
&nbsp; &nbsp; &nbsp; &nbsp; res=req.read()<br />
&nbsp; &nbsp; &nbsp; &nbsp; return True<br />
&nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;&lt;Error reading from the website&gt;&quot;)<br />
<br />
def get_command():<br />
&nbsp; &nbsp; if True:<br />
&nbsp; &nbsp; &nbsp; &nbsp; for x in res:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(x!='&lt;'):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; command+=x<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break<br />
&nbsp; &nbsp; determine()<br />
<br />
command=&quot;&quot;<br />
<br />
def determine():<br />
&nbsp; &nbsp; format=command&#91;len(command)-3:&#93;<br />
&nbsp; &nbsp; print format<br />
<br />
get_html()<br />
get_command()</pre><br />
The problem is:<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  &gt;&gt;&gt; <br />
Traceback (most recent call last):<br />
  File &quot;C:\Documents and Settings\Sravan\My Documents\Sravan\PYTHON\Accepshun.py&quot;, line 32, in &lt;module&gt;<br />
    get_command()<br />
  File &quot;C:\Documents and Settings\Sravan\My Documents\Sravan\PYTHON\Accepshun.py&quot;, line 18, in get_command<br />
    for x in res:<br />
NameError: global name 'res' is not defined<br />
&gt;&gt;&gt;   <hr /> </td> </tr> </table> </div>I understand that get_command() doesn't know what 'res' is, but how do I solve this problem?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221447.html</guid>
		</item>
		<item>
			<title>Searching Weather for a term with urllib2 module</title>
			<link>http://www.daniweb.com/forums/thread221380.html</link>
			<pubDate>Tue, 08 Sep 2009 07:51:07 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I am making a program called 'Weather Watch' which basically gets weather updates for any city you type in. 
 
For now, it only gets info for a particular city. I don't know how to search for the term entered in www.weather.com and then get the updates. The code so far: 
 
import...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I am making a program called 'Weather Watch' which basically gets weather updates for any city you type in.<br />
<br />
For now, it only gets info for a particular city. I don't know how to search for the term entered in <a rel="nofollow" class="t" href="http://www.weather.com" target="_blank">www.weather.com</a> and then get the updates. The code so far:<br />
 <pre style="margin:20px; line-height:13px">import urllib2 as url<br />
import os<br />
import time<br />
<br />
os.system('cls')<br />
<br />
print(&quot;&#91;Content provided by The Weather Channel&#93;&quot;)<br />
time.sleep(3)<br />
os.system('cls')<br />
<br />
print(&quot;Please wait...this may take a few seconds.&quot;)<br />
time.sleep(3)<br />
os.system('cls')<br />
<br />
condition=True<br />
<br />
try:<br />
&nbsp; &nbsp; url_open=url.urlopen(&quot;http://www.weather.com&quot;)<br />
&nbsp; &nbsp; lines=url_open.readlines()&#91;1192:1199&#93;<br />
except:<br />
&nbsp; &nbsp; condition=False<br />
<br />
if(condition):<br />
&nbsp; &nbsp; print(&quot;Weather forecast for Bangalore, INDIA\n&quot;)<br />
&nbsp; &nbsp; for x in lines:<br />
&nbsp; &nbsp; &nbsp; &nbsp; onsplit=x.split(&quot;&gt;&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; tags=onsplit&#91;2&#93;&#91;:-5&#93;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(tags==&quot;Pressure:&quot;):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data=onsplit&#91;4&#93;&#91;:5&#93;<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif(tags==&quot;Dew Point:&quot;):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data=onsplit&#91;4&#93;&#91;:2&#93;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data=onsplit&#91;4&#93;&#91;:-5&#93;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; print(tags+&quot; &quot;+data)<br />
&nbsp; &nbsp; raw_input(&quot;\n&lt;Any key to quit&gt;&quot;)</pre><br />
This is what I've learnt on searching for a term in a site[Google, here]<br />
<br />
 <pre style="margin:20px; line-height:13px">import urllib2 as url2<br />
import urllib as url<br />
<br />
values={&quot;search&quot;:&quot;city&quot;}<br />
<br />
data=url.urlencode(values)<br />
<br />
req=url2.Request(&quot;http://www.google.com&quot;,data)<br />
res=url2.urlopen(req)<br />
<br />
print(res.read())</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221380.html</guid>
		</item>
		<item>
			<title><![CDATA[How to use Mozilla's YouTube downloader?]]></title>
			<link>http://www.daniweb.com/forums/thread215482.html</link>
			<pubDate>Tue, 01 Sep 2009 15:57:04 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I am working on a Python project which will enable to watch movies on YouTube easily. 
 
I have added 'YouTube Video Downloader' as an add-on to my Mozilla we browser. Now, everytime I enter a list of URLs containing the movie I want to watch in parts, the program should open the URL,...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I am working on a Python project which will enable to watch movies on YouTube easily.<br />
<br />
I have added 'YouTube Video Downloader' as an add-on to my Mozilla we browser. Now, everytime I enter a list of URLs containing the movie I want to watch in parts, the program should open the URL, and use the add-on to download the video. How is it possible? I have some basic code here, but have no clue on how to use the add-on<br />
 <pre style="margin:20px; line-height:13px">import time<br />
import urllib2<br />
import os<br />
<br />
print(&quot;Welcome.&quot;)<br />
n=input(&quot;How many parts are there of the video you want to watch? &quot;)<br />
print(&quot;Please wait...&quot;)<br />
<br />
time.sleep(3)<br />
os.system('cls')<br />
<br />
s=&#91;&#93;<br />
<br />
for x in range(n):<br />
&nbsp; &nbsp; s.append(raw_input(&quot;Enter URL: &quot;))<br />
<br />
os.system('cls')<br />
<br />
for x in s:<br />
&nbsp; &nbsp; urllib.urlopen(x)</pre><br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>sravan953</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread215482.html</guid>
		</item>
	</channel>
</rss>
