Go to advanced search

by FeersumEndjinn
Mon Nov 03, 2014 8:19 pm
Forum: Python
Topic: Python3.4 decoding byte string to anything else?
Replies: 2
Views: 1390

Python3.4 decoding byte string to anything else?

Hi, In Python 3.4, I have a variable called 'line', and when I print it, I get: b'<a href="matchdayapp_matches_audit_trail.asp?f=1604172">1604172</a>' As you can see, this is a byte string as noted by the leading 'b'. What I'm trying to do is decode this to UTF-8 or ASCII or ANYTHING useful, but I c...
by FeersumEndjinn
Fri Sep 05, 2014 12:50 pm
Forum: Python
Topic: Travis-CI build issues
Replies: 1
Views: 1099

Travis-CI build issues

Hi, I know that a lot of people here won't have any experience with Travis-CI, but I'm going to ask anyway as I am well and truly stuck now. I have been using Travis-CI to automate build testing. Each time I push a git repo to github, Travis will test the build and provide a status in response. My m...
by FeersumEndjinn
Thu Sep 04, 2014 1:05 pm
Forum: Python
Topic: Rename file within module
Replies: 3
Views: 669

Re: Rename file within module

Dave,

You appear to have misread my post - that is EXACTLY what I want to do, but it isn't working if I do that...
by FeersumEndjinn
Wed Sep 03, 2014 2:11 pm
Forum: Python
Topic: Rename file within module
Replies: 3
Views: 669

Rename file within module

Hi, I have written and published a python module called 'surrealism' to pypi. However, I believe that the layout I have chosen is not the best, and I want to correct it for a variety of reasons. At the moment in my project, we have: surrealism\ ....__init__.py ....surrealism.sqlite All of the code f...
by FeersumEndjinn
Tue Jul 01, 2014 12:54 am
Forum: Python
Topic: using os.walk() recursively
Replies: 3
Views: 1853

using os.walk() recursively

Hi, I have a folder structure that I want to walk, look at each file and directory as I go. I am using os.walk() but I am having trouble with the depth and walking back up the path. master_dir ....dir1/ ....file1 ....file2 ........dir2/ ............file3 ........dir3/ ............file4 os.walk() wor...
by FeersumEndjinn
Mon Jun 16, 2014 3:45 pm
Forum: Python
Topic: Iterating and removing items from a list
Replies: 3
Views: 800

Re: Iterating and removing items from a list

Many thanks - I ended up actually doing both - working in reverse (which caused a new issue!) and then ultimately creating a new list for matches, rather than trying to remove non-matches from the current list.

Many thanks for the advice.
by FeersumEndjinn
Mon Jun 16, 2014 2:16 pm
Forum: Python
Topic: Iterating and removing items from a list
Replies: 3
Views: 800

Iterating and removing items from a list

Hi, I'm iterating through a list of filenames, and any filename that doesn't match a particular pattern (contains '.config' in the filename currently) is removed from the list. However, when there are 2 files in a list (say .txt) one after the other, there is a problem: def check_for_matching_files(...
by FeersumEndjinn
Wed Feb 26, 2014 8:09 pm
Forum: Troubleshooting
Topic: apt-get upgrade issue with dpkg.
Replies: 4
Views: 1735

Re: apt-get upgrade issue with dpkg.

Yes of course I have - I always run apt-get update before apt-get upgrade.
by FeersumEndjinn
Wed Feb 26, 2014 5:19 pm
Forum: Troubleshooting
Topic: apt-get upgrade issue with dpkg.
Replies: 4
Views: 1735

apt-get upgrade issue with dpkg.

Hi All, I've been using linux for over 10 years but I am stuck with an error when trying to upgrade using apt-get. Whenever I issue sudo apt-get upgrade I get the following error: [email protected] ~ $ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... ...
by FeersumEndjinn
Mon Jan 20, 2014 3:16 pm
Forum: Python
Topic: Unittest self.assertIsInstance not a valid attribute?
Replies: 3
Views: 1341

Re: Unittest self.assertIsInstance not a valid attribute?

Hi, That works (i.e. I don't need __init__ - many thanks) but I still receive the same error. I had actually simplified the code slightly to demonstrate the issue - the string returned is actually a unicode string but the full code below: import surrealism as s import unittest class SurrealismUnitte...
by FeersumEndjinn
Mon Jan 20, 2014 1:51 pm
Forum: Python
Topic: Unittest self.assertIsInstance not a valid attribute?
Replies: 3
Views: 1341

Unittest self.assertIsInstance not a valid attribute?

Hi all, I'm writing unit tests for my first real python module - it's been on pypi for months and is doing well, but now I need to step up a gear on the professionalism ladder and learn to write proper unit tests for my code. In future tests will come first and then develop from there with true TDD....
by FeersumEndjinn
Mon Jan 20, 2014 12:32 pm
Forum: Python
Topic: How to reference code in another directory?
Replies: 5
Views: 824

Re: How to reference code in another directory?

Hmmm, surely there must be a simple solution. How do people normally structure projects that have unit tests in them? I'm more than happy to be flexible and restructure my work if there is an easier, conventional way? This is as I'm writing and testing code locally - I'm not going through the proces...
by FeersumEndjinn
Mon Jan 20, 2014 10:28 am
Forum: Python
Topic: How to reference code in another directory?
Replies: 5
Views: 824

How to reference code in another directory?

Hi, I have written a python module and uploaded it to pypi, but so far I haven't delved into unit testing. I am now looking into it, but I'm having a problem referencing code in another directory? My python module is called 'surrealism' and isn't a class, just functions so its code lives in project/...
by FeersumEndjinn
Fri Jan 10, 2014 8:15 pm
Forum: Python
Topic: Issue with pkg_resources - returns incorrect data?
Replies: 2
Views: 592

Re: Issue with pkg_resources - returns incorrect data?

You hit the nail on the head my friend - my development environment was dirty and had an old installed version lying around - you helped me find and identify that, so many thanks!
by FeersumEndjinn
Fri Jan 10, 2014 4:14 pm
Forum: Python
Topic: Issue with pkg_resources - returns incorrect data?
Replies: 2
Views: 592

Issue with pkg_resources - returns incorrect data?

Hi all, I'm trying to use pkg_resources to pull the version number from my setup.py script in my module. However, I'm having VERY odd results: setup.py: setup(name = 'surrealism', version = '0.9.1', packages=["surrealism"], module function: import pkg_resources def version(): version = pkg_resources...
by FeersumEndjinn
Mon Jan 06, 2014 4:53 pm
Forum: Python
Topic: urllib2 not fetching what I'm seeing
Replies: 5
Views: 1212

Re: urllib2 not fetching what I'm seeing

Selenium!

You sir, are a genius. Selenium appears to be exactly what I need.

Many Thanks,
by FeersumEndjinn
Mon Jan 06, 2014 2:05 pm
Forum: Python
Topic: urllib2 not fetching what I'm seeing
Replies: 5
Views: 1212

Re: urllib2 not fetching what I'm seeing

Hi, The link is kind of useful but I'm still a little unsure. After following the advice on that site, I've found the data that appears to be submitted on a form, and the result is the table I want to scrape. So, now I am trying to submit the form in python. First of all, the HTML I found is: <body ...
by FeersumEndjinn
Mon Jan 06, 2014 11:56 am
Forum: Python
Topic: hi i keep getting an invalid syntax error when programming.
Replies: 2
Views: 658

Re: hi i keep getting an invalid syntax error when programmi

Hi, If that is a straight copy of your code, the error is easy to see: bullet=Bullet(turret.get_gun_position()) bullet_sprites.add(bullet if ticktock >=120: ticktock=0 if len(live_fruit_sprites)<10: live_fruit_sprites.add((Fruit(WINDOWWIDTH))) Whilst the syntax error is saying the problem is with th...
by FeersumEndjinn
Mon Jan 06, 2014 11:43 am
Forum: Python
Topic: urllib2 not fetching what I'm seeing
Replies: 5
Views: 1212

urllib2 not fetching what I'm seeing

Hi all, I'm trying to pull data from a webpage, but the data returned doesn't match what I'm seeing on the screen, due to the website using DotNetNuke CMS system. The URL I have is : http://www.eiha.co.uk/Leagues/NIHLMORALEECONFERENCE.aspx What I want to retrieve are the results in the table into a ...
by FeersumEndjinn
Thu Oct 31, 2013 9:54 am
Forum: Camera board
Topic: Pi NoIR video
Replies: 14
Views: 2626

Re: Pi NoIR video

Has anyone found a good way to mount the blue plastic permanently without having to hold it? I'm ideally talking something a little better than scotch-tape if possible!

Cheers,
Morrolan
by FeersumEndjinn
Mon Oct 07, 2013 2:11 pm
Forum: Other programming languages
Topic: SQLite3 woes
Replies: 3
Views: 1184

SQLite3 woes

Hi all, I'm having trouble with some SQLite syntax for a program I'm writing and runnign on my Pi. The SQL syntax is: INSERT INTO stock_history( sth_id, sth_name, sth_summary, sth_company_code, sth_company_name, sth_index, sth_current_price, sth_high_price, sth_low_price, sth_price_movement, sth_pri...
by FeersumEndjinn
Tue Sep 24, 2013 9:19 am
Forum: Python
Topic: Error with Unicode
Replies: 7
Views: 1598

Re: Error with Unicode

After reading an excellent presentation (http://farmdev.com/talks/unicode/) on unicode, I now realise quite how unicode works and that I should decode strings to unicode as early as possible. This is now working. Example below: import json import urllib2 AJAX_URL = 'http://socialclub.rockstargames.c...
by FeersumEndjinn
Mon Sep 23, 2013 7:49 pm
Forum: Python
Topic: Error with Unicode
Replies: 7
Views: 1598

Re: Error with Unicode

After 5 minutes of playing following your advice, I think I have it!

I was doing things the wrong was round - I was trying to encode the web data to utf-8, when in reality I needed to DECODE the utf-8 into unicode!

Thanks a lot for the pointers!
by FeersumEndjinn
Mon Sep 23, 2013 7:42 pm
Forum: Python
Topic: Error with Unicode
Replies: 7
Views: 1598

Re: Error with Unicode

In ll honesty, whilst I understand the differences different encodings offer, this is the first time I've really had to deal with it programatically as I normally write SQL for a living and it's fairly straightforward to force particular encodings at the database level. I will take your advice and s...
by FeersumEndjinn
Mon Sep 23, 2013 6:26 pm
Forum: Python
Topic: Error with Unicode
Replies: 7
Views: 1598

Re: Error with Unicode

I wonder if perhaps it is related to the source data? What I didn't make clear above is that the data is actually being read off the net - I had just inserted the data into that script for testing purposes. I'm pulling the source material from: http://socialclub.rockstargames.com/games/gtav/ajax/sto...

Go to advanced search