Python Weather App

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.

Python Weather App

Postby ChristianCareaga » Thu Jul 25, 2013 3:57 am

I just finished writing a weather application that gives you the current weather

i used bs4 to parse the info and pygame for the gui (gui code is a bit messy and clunky)

Here is the github repo:
https://github.com/C-Dubb/WeatherApp

If you download it please star the repo!

here is a screenshot of it!

weather.png
Weather App
weather.png (240.34 KiB) Viewed 741 times


had to scale it so resolution got messed up

hope you guys like it!
ChristianCareaga
 
Posts: 45
Joined: Sat Jun 22, 2013 9:54 am

Re: Python Weather App

Postby micseydel » Thu Jul 25, 2013 4:42 am

Cool, but fix weather.pyw:17, and in case you didn't know, the sys.path.append() hack is not how you should leave you code. It's better to change how file are laid out.
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 940
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Python Weather App

Postby ChristianCareaga » Thu Jul 25, 2013 5:03 am

micseydel wrote:Cool, but fix weather.pyw:17, and in case you didn't know, the sys.path.append() hack is not how you should leave you code. It's better to change how file are laid out.


weather.pyw:17 ? and i didnt know that im relatively new to python
ChristianCareaga
 
Posts: 45
Joined: Sat Jun 22, 2013 9:54 am

Re: Python Weather App

Postby micseydel » Thu Jul 25, 2013 5:08 am

Line 17 in that file has a backslash.
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 940
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Python Weather App

Postby Mekire » Thu Jul 25, 2013 5:18 am

Crashing on startup:
Code: Select all
>>>
C:\Python27\lib\site-packages\bs4\builder\_htmlparser.py:154: RuntimeWarning: Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help.
  "Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help."))

Traceback (most recent call last):
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 124, in <module>
    Weather()
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 14, in __init__
    self.get_info()
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 91, in get_info
    get_info.get_info(self.zip)
  File "info\get_info.py", line 8, in get_info
    soup = BeautifulSoup(content)
  File "C:\Python27\lib\site-packages\bs4\__init__.py", line 172, in __init__
    self._feed()
  File "C:\Python27\lib\site-packages\bs4\__init__.py", line 185, in _feed
    self.builder.feed(self.markup)
  File "C:\Python27\lib\site-packages\bs4\builder\_htmlparser.py", line 155, in feed
    raise e
HTMLParseError: malformed start tag, at line 1, column 4633
>>>

Windows 7, python 2.7, freshly installed bs4.
-Mek
User avatar
Mekire
 
Posts: 828
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: Python Weather App

Postby micseydel » Thu Jul 25, 2013 5:20 am

I'm on Linux, and once I fixed the backslash, it ran fine for me.
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 940
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Python Weather App

Postby ChristianCareaga » Thu Jul 25, 2013 5:23 am

Mekire wrote:Crashing on startup:
Code: Select all
>>>
C:\Python27\lib\site-packages\bs4\builder\_htmlparser.py:154: RuntimeWarning: Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help.
  "Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help."))

Traceback (most recent call last):
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 124, in <module>
    Weather()
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 14, in __init__
    self.get_info()
  File "C:\Users\Owner\Desktop\WeatherApp-master\weather\weather.pyw", line 91, in get_info
    get_info.get_info(self.zip)
  File "info\get_info.py", line 8, in get_info
    soup = BeautifulSoup(content)
  File "C:\Python27\lib\site-packages\bs4\__init__.py", line 172, in __init__
    self._feed()
  File "C:\Python27\lib\site-packages\bs4\__init__.py", line 185, in _feed
    self.builder.feed(self.markup)
  File "C:\Python27\lib\site-packages\bs4\builder\_htmlparser.py", line 155, in feed
    raise e
HTMLParseError: malformed start tag, at line 1, column 4633
>>>

Windows 7, python 2.7, freshly installed bs4.
-Mek


hmmm thats weird im running python 2.7 with bs4 on XP
ChristianCareaga
 
Posts: 45
Joined: Sat Jun 22, 2013 9:54 am

Re: Python Weather App

Postby Mekire » Thu Jul 25, 2013 5:26 am

I just installed html5lib and now it works. Might want to mention that dependency.
You also might want to consider just packaging those modules with your app as they aren't particularly big.

-Mek
User avatar
Mekire
 
Posts: 828
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: Python Weather App

Postby ChristianCareaga » Thu Jul 25, 2013 5:54 am

Mekire wrote:I just installed html5lib and now it works. Might want to mention that dependency.
You also might want to consider just packaging those modules with your app as they aren't particularly big.

-Mek


oh ok interesting i never installed html5lib
ChristianCareaga
 
Posts: 45
Joined: Sat Jun 22, 2013 9:54 am

Re: Python Weather App

Postby Mekire » Thu Jul 25, 2013 5:56 am

The error message said either html5lib or lxml. Do you have the latter?

-Mek
User avatar
Mekire
 
Posts: 828
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan


Return to Completed Scripts

Who is online

Users browsing this forum: No registered users and 1 guest