LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2011, 08:18 PM   #1
bloodyscript
Member
 
Registered: Apr 2006
Distribution: Sabayon linux 5.1
Posts: 182

Rep: Reputation: 15
python displaying list contents in scrollable window error


i have two sections of code

Code:
def file_ok_sel(self, w):
                  print "%s" % self.filew.get_filename()
                  self.list.append(self.filew.get_filename())
works fine here>>>self.contents = "\n".join(self.list)
                  self.plbuffer.set_text(self.contents)
this code enters the filename and path like so /home/bludiescript/mplay.py

second code

Code:
def search_entry(self, widget):
         search = self.search.get_text()
         top = '/home/bludiescript/tv-shows'
                for dirpath, dirnames, filenames in os.walk(top):
                        for filename in filenames:
                                if re.findall(search, filename):
                                   #print os.path.join([dirpath, filename],)
                                   self.list.append(os.path.join([dirpath, filename],))
          gives an error here>>>>>>self.contents = "\n".join(self.list)
                                   self.plbuffer.set_text(self.contents)
                                   print self.list
when the self.list prints entries look as so ['/home/bludiescript/tv-shows/japanesse/steins gate', '[HorribleSubs] Steins;Gate - 10 [720p].mkv']

Code:
error =   file "./mplay1.py" , line 77 in search_entry 
          self.contents = "/n".join(self.list) line 
          typeerror sequence item o: expecting string, list found
so why doesn't this line work where it is ?
 
Old 09-24-2011, 08:44 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005
I would uncomment the following:
Code:
#print os.path.join([dirpath, filename],)
After doing so, I would see what dirpath and filename contain, since technically according to your error output, it says that a list is being found, instead of a string, which in that case, what it needs.

Cheers,

Josh
 
Old 09-25-2011, 01:38 AM   #3
bloodyscript
Member
 
Registered: Apr 2006
Distribution: Sabayon linux 5.1
Posts: 182

Original Poster
Rep: Reputation: 15
yes it does work when i un comment the line but thats not what i need it to do. id like it to print to the list self.list and have self.list be set as the text in the scrollable window by way of self.contents
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python script using tar from a list returns error: has no attribute 'startswith' linux1103 Linux - Newbie 3 04-05-2011 07:17 PM
[SOLVED] awk code help for displaying file contents ashok.g Programming 13 12-14-2009 12:55 AM
my cd contents file names not displaying morethan 8 digits. AMajeed AIX 5 08-08-2007 09:56 AM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 04:02 AM
win_c, floppy, cdrom are not displaying contents clockworkorange Linux - General 13 12-28-2001 10:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration