problems with opening files due to file's path

2008-06-10 Thread Alexnb
Okay, so what I want my program to do it open a file, a music file in specific, and for this we will say it is an .mp3. Well, I am using the system() command from the os class. The problem I am running into is that when I send the path of the file to the system() command, which for those of you wh

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
Gerhard Häring wrote: > > Alexnb wrote: >> Okay, so what I want my program to do it open a file, a music file in >> specific, and for this we will say it is an .mp3. Well, I am using the >> system() command from the os class. [...] >> >> system("\&qu

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
Hey thanks!, both the raw and the double backslashes worked. You are a gentleman and a scholar. Mike Driscoll wrote: > > On Jun 10, 11:45 am, Alexnb <[EMAIL PROTECTED]> wrote: >> Gerhard Häring wrote: >> >> > Alexnb wrote: >> >> Okay, so what I

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
to make that work or better yet, how to take a regular string that is given and make every single "\" into a double "\\"? Mike Driscoll wrote: > > On Jun 10, 11:45 am, Alexnb <[EMAIL PROTECTED]> wrote: >> Gerhard Häring wrote: >> >> > Alexnb wrote:

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
(r"%s"%variable) > > -- > From: "Alexnb" <[EMAIL PROTECTED]> > Sent: Tuesday, June 10, 2008 7:05 PM > To: > Subject: Re: problems with opening files due to file's path > >> >> Well, now i&#

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
his is what you are talking about. If you were referring to > passing in arguments, than you'll want to use the subprocess module > instead. > > >> >> -- >> From: "Alexnb" <[EMAIL PROTECTED]> >> Sent: Tuesday, June 10, 2008 7:05 PM >> To:

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
r a number next to the backslash "\" in the file path. I am looking for a way to make it work with a variable, I can make it work when I physically type it in, but not with a variable that holds the path. Mike Driscoll wrote: > > On Jun 10, 1:57 pm, Alexnb <[EMAIL PROTECTED]>

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
;m Yours (Single)\\01 - I'm >>> Yours.wma") It works out fine because I can make each backslash doubles so it doesn't mess stuff up. So if I could take the path varible and make ever "\" into a "\\" then it would also work. Did I clarify? Grant Edwar

Re: problems with opening files due to file's path

2008-06-10 Thread Alexnb
I don't think you understand it doesn't matter how the variable gets there, the same code is run regardless, I have no problem with the GUI, but you asked, and so I told you. the code os.startfile( is run if there is a GUI or it is a console app. Carsten Haese-2 wrote: > &

Re: problems with opening files due to file's path

2008-06-11 Thread Alexnb
Okay, so as a response to all of you, I will be using the Entry() widget in Tkinter to get this path. and the repr() function just makes all my backslashes 4 instead of just 1, and it still screwes it up with the numbers and parenthesis is has been since the first post. Oh and I know all about esc

Re: problems with opening files due to file's path

2008-06-11 Thread Alexnb
tartfile(path) this is very simplified, but that is the idea, and basically exactly what will happen, just if the path has some of those characters that conflict with the \. Carsten Haese-2 wrote: > > Alexnb wrote: >> Okay, so as a response to all of you, I will be using the Entry(

Re: problems with opening files due to file's path

2008-06-11 Thread Alexnb
. Thats it, I'll write some code of what it should work like, because I probably should have done that; but you don't have to act like I am retarded... that solves nothing. Grant Edwards wrote: > > On 2008-06-11, Alexnb <[EMAIL PROTECTED]> wrote: > >> Okay, so as a re

basic code of what I am doing

2008-06-11 Thread Alexnb
in the entry box" self.buttonClick() root = Tk() myapp = myApp(root) root.mainloop() [code] Alexnb wrote: > > I don't get why yall are being so rude about this. My problem is this; the > path, as a variable conflicts with other characters in the path,

Re: problems with opening files due to file's path

2008-06-11 Thread Alexnb
d, Jun 11, 2008 at 4:16 PM, Alexnb <[EMAIL PROTECTED]> wrote: >> >> I posted the underlying code, but I haven't made the GUI code because if >> I >> can't get the underlying code right it doesn't matter, well in my eyes it >> doesn't but I am probably

Re: problems with opening files due to file's path

2008-06-11 Thread Alexnb
Haha, okay well sorry that I was being so stupid, but I get it now and I apoligize for causing you all the frustration. But I did get it to work finally. Carsten Haese-2 wrote: > > Alexnb wrote: >> I don't get why yall are being so rude about this. > > We're f

best way to create a timer/alarm

2008-06-12 Thread Alexnb
I am wondering what is the best way to create a timer, like an alarm, once it reaches a time, it triggers an event. I have a way of doing this but it seems like it isn't good at all. If it helps at all I am using a Tkinter, but that probably doesn't mean much. The way I was doing it was using a wh

os.startfile() on a mac

2008-06-13 Thread Alexnb
So i have a mac and pc, and just found out that os.startfile() doesn't work on a mac. So is there anything like that besides os.system()? -- View this message in context: http://www.nabble.com/os.startfile%28%29-on-a-mac-tp17829335p17829335.html Sent from the Python - python-list mailing list a

using urllib2

2008-06-27 Thread Alexnb
I have never used the urllib or the urllib2. I really have looked online for help on this issue, and mailing lists, but I can't figure out my problem because people haven't been helping me, which is why I am here! :]. Okay, so basically I want to be able to submit a word to dictionary.com and then

Re: using urllib2

2008-06-27 Thread Alexnb
Okay, I tried to follow that, and it is kinda hard. But since you obviously know what you are doing, where did you learn this? Or where can I learn this? Maric Michaud wrote: > > Le Friday 27 June 2008 10:43:06 Alexnb, vous avez écrit : >> I have never used the urllib or the urlli

Re: using urllib2

2008-06-27 Thread Alexnb
is pretty straightforward > once you've used it a few times. Some of the class naming and whatnot > takes a bit of getting used to (I found that to be the most confusing > bit). > > On Jun 27, 1:41 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> Okay, I tried to follow t

Re: using urllib2

2008-06-27 Thread Alexnb
s naming and whatnot > takes a bit of getting used to (I found that to be the most confusing > bit). > > On Jun 27, 1:41 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> Okay, I tried to follow that, and it is kinda hard. But since you >> obviously >> know what you are

Re: using urllib2

2008-06-27 Thread Alexnb
ke. ', u'an > ornamental fastening for the front of a coat, consisting of a button > and a loop through which it passes. ', u'a sheath suspended from a > belt and supporting a scabbard. ', u'a device at the intersection of > two tracks to permit the wheels a

Re: using urllib2

2008-06-29 Thread Alexnb
{'class': 'luna-Ent'}):" Like why the curly braces and whatnot? Jeff McNeil-2 wrote: > > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> Okay, so I copied your code(and just so you know I am on a mac right now >> and >> i am usin

Re: using urllib2

2008-06-29 Thread Alexnb
of the definitions that worked had them in it in the same format. Any Ideas??! Jeff McNeil-2 wrote: > > On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> No I figured it out. I guess I never knew that you aren't supposed to >> split a >> url like "ht

Re: using urllib2

2008-06-29 Thread Alexnb
Actually after looking at this, the code is preactically the same, except the definitions. So what COULD be going wrong here? Alexnb wrote: > > Okay, so i've hit a new snag and can't seem to figure out what is wrong. > What is happening is the first 4 definitions of the

Re: using urllib2

2008-06-29 Thread Alexnb
were in. So what is the deal!?! >>> soup.findAll('table', {'class': 'luna-Ent'}) [1.easy to understand, deal with, use, etc.: a simple matter; simple tools. See there is the first one in the shell, I mean it is there, but the for loop can't find it. I am

Problem with a for loop and a list

2008-07-02 Thread Alexnb
I am not sure what is going on here. Here is the code that is being run: def getWords(self): self.n=0 for entry in self.listBuffer: self.wordList[self.n] = entry.get() self.n=self.n+1 print self.wordList This is the "listBuffer" that you see: sel

Re: Problem with a for loop and a list

2008-07-02 Thread Alexnb
well okay, so what can I do? A.T.Hofkamp-3 wrote: > > On 2008-07-02, Alexnb <[EMAIL PROTECTED]> wrote: >> I have no idea what "list assignment index out of range means?!?! > > You are assigning a value to a non-existing list element, as in > >>>

Re: Problem with a for loop and a list

2008-07-02 Thread Alexnb
taken up. Terry Reedy wrote: > > > > Alexnb wrote: >> I am not sure what is going on here. Here is the code that is being run: >> >> def getWords(self): >> self.n=0 >> for entry in self.listBuffer: >> self.wordList[sel

Testing for an empty list

2008-07-03 Thread Alexnb
Okay this is a simple question I just don't know how. If I have a list, say: funList = [] and after a while something possible should have been appended to it, but wasn't. How can I test if that list is empty. -- View this message in context: http://www.nabble.com/Testing-for-an-empty-list-tp1

Trouble with Tkinter text margins

2008-07-07 Thread Alexnb
I am writing a program in which there is a textbox and in it the program auto inputs a series of words, and definitions for each word. I want to make it formatted nicely to where the word is indented, and the definitions indented even more. I don't even know how to make the margins work. I have re

Help with using findAll() in BeautifulSoup

2008-07-11 Thread Alexnb
Okay, I am not sure if there is a better way of doing this than findAll() but that is how I am doing it right now. I am making an app that screen scapes dictionary.com for definitions. However, I would like to have the type of the word for each definition. For example if def1 and def2 are noun def

Help with BeautifulSoup

2008-07-11 Thread Alexnb
Okay, heres the general idea of the html I have to work with: noun verb Okay, I left off some stuff. But what I need to do is get what is inside each and then each . But the key is that I need everything in the EXACT order that it would be in the html. I can

Re: Help with BeautifulSoup

2008-07-12 Thread Alexnb
Michiel Overtoom wrote: > > Alex wrote... >> >>Okay, heres the general idea of the html I have to work with: >> >> >> noun >> >> >> >> >> verb >> >> >> >> >> >>Okay, I left off some stuff. > > I wish you didn't, or at least provided an URL where I can get the page > w

like py2exe, but on a mac

2008-07-12 Thread Alexnb
Hi All I am wondering what I can do to turn a python app (.py) into a mac OSX applicaiton (.app). Just like py2exe does. But I am also wondering since in your applications folder on macs it usually doesn't have an actual folder for each app. Rather an icon. so for firefox, you just see the icon.

Re: like py2exe, but on a mac

2008-07-12 Thread Alexnb
Python.Arno wrote: > > > On 13 jul 2008, at 00:39, Alexnb wrote: > >> >> Hi All >> >> I am wondering what I can do to turn a python app (.py) into a mac OSX >> applicaiton (.app). Just like py2exe does. > > i use these: > http://undefined.o

Testing for Internet Connection

2008-07-15 Thread Alexnb
Hello internet. I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p -- View this message in context: http://www.nabble.com/Testing-for-Internet-Connection-tp18460572p18460572.html Sent from the Python - python-list mailing list archive at Nabbl

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Ben Finney-2 wrote: > > Alexnb <[EMAIL PROTECTED]> writes: > >> I am wondering, is there a simple way to test for Internet >> connection? If not, what is the hard way :p > > Refine the question: What do you mean by "internet"? It isn't a si

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Troeger Thomas (Ext) wrote: > > Alex Marandon wrote: >> Alexnb wrote: >>> I am wondering, is there a simple way to test for Internet connection? >>> If >>> not, what is the hard way :p >> >> Trying to fetch the homepage from a few major web

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Alex Marandon-3 wrote: > > Alexnb wrote: >> I am wondering, is there a simple way to test for Internet connection? If >> not, what is the hard way :p > > Trying to fetch the homepage from a few major websites (Yahoo, Google, > etc.)? If all of them are failing

Testing for connection to a website

2008-07-15 Thread Alexnb
Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to connect to a specific website. Last time I got pointed to the urllib2 page, but if I do urlopen() and and am not connected, the program stops. So I don't know if that was what y

Re: Testing for connection to a website

2008-07-15 Thread Alexnb
Alexnb wrote: > > Okay, I already made this post, but it kinda got lost. So anyway I need to > figure out how to test if the user is able to connect to a specific > website. Last time I got pointed to the urllib2 page, but if I do > urlopen() and and am not connected, the prog

Re: Testing for connection to a website

2008-07-15 Thread Alexnb
Timothy Grant wrote: > > On Tue, Jul 15, 2008 at 3:48 PM, Alexnb <[EMAIL PROTECTED]> wrote: > >> >> >> >> Alexnb wrote: >> > >> > Okay, I already made this post, but it kinda got lost. So anyway I need >> to >> > figure o

Re: Testing for connection to a website

2008-07-16 Thread Alexnb
Fredrik Lundh wrote: > > Alexnb wrote: > >> e = '' > >> try: >> ... >> except HTTPError, e: >> print e.code >> except URLError, e: >> print e.reason >> >> if e == '': >> pri

py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are stored in the same directory as the source, something like: C:\Docs and settings\me\My docs\python\prog

Re: py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Mike Driscoll wrote: > > On Jul 16, 1:37 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> Hello >> >> I am sure most of you are familiar with py2exe. I am having a bit of a >> problem. See the program has a few pictures involved and the .ico it uses >> for the

Re: py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Alexnb wrote: > > > > Mike Driscoll wrote: >> >> On Jul 16, 1:37 pm, Alexnb <[EMAIL PROTECTED]> wrote: >>> Hello >>> >>> I am sure most of you are familiar with py2exe. I am having a bit of a >>> problem. See the progra

Having trouble with some lists in BeautifulSoup

2008-07-16 Thread Alexnb
Okay, what I want to do with this code is to got to thesaurus.reference.com and then search for a word and get the syns for it. Now, I can get the syns, but they are still in html form and some are hyperlinks. But I can't get the contents out. I am not that familiar with BeautifulSoup. So if anyon

Need help getting BeautifulSoup contents

2008-07-16 Thread Alexnb
The trick to this one is that the html looks something like this: american, /browse/blue blue , /browse/brick brick , brie, cheddar, cheshire, /browse/churn churn , /browse/cottage cottage , /browse/cream cream , dunlop, and it goes on My question is I want everything inside, the conten

Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Hello Lets say I have a string: --a href="/browse/brick"--brick--/a-- The -- needs to be replaced with < or > where applicable. and I want the "brick" out of that string (the second brick that is). How can I get just the "brick" out of that string? -- View this message in context: http://ww

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Alexandr N Zamaraev wrote: > s = '--a href="/browse/brick"--brick--/a--' s > '--a href="/browse/brick"--brick--/a--' ''.join('<%s>' % l if i % 2 == 1 else l for i, l in > enumerate(s.split('--'))) > ' /browse/brick brick ' > > -- > http://mail.python.org/mailman/listinfo/python

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Alexandr N Zamaraev wrote: > > Alexnb wrote: >>>>>> s = '--a href="/browse/brick"--brick--/a--' >>>>>> s >>> '--a href="/browse/brick"--brick--/a--' >>>>>> ''.join('<

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
bearophileHUGS wrote: > > On Jul 17, 9:50 am, Alexnb: >> how can I test to see if the first char of a string is "<"? > > I suggest you to try the interactive shell: > >>>> "hello"[0] > 'h' >>>> "hell

simple problem with lists I am just forgetting

2008-07-31 Thread Alexnb
Lets say we have this list: funlist = ['a', 'b', 'c'] and lets say I do this: if funlist[4]: print funlist[4] I will get the exception "list index out of range" How can I test if the list item is empty without getting that exception? -- View this message in context: http://www.nabble.co

Testing for the first few letters of a string

2008-08-07 Thread Alexnb
Okay, I have a fix for this problem, but it is messy and I think there might be a better way. Heres an example: Lets say I have a string: "My name is alex" and I have another string "My name is alex, and I like pie". I want to test to see if just the "My name is alex" part is there. I don't ca

Remove the first few(or any amount really) of letters in a string

2008-08-08 Thread Alexnb
Lets say I've got a stirng: blah This is my string blah I want to get rid of the blah's but keep the "This is my string." I know you can do this with a for loop, but that is messy and a pain. So does anyone have any suggestions on how to do this? -- View this message in context: http://www.nab

like a "for loop" for a string

2008-08-17 Thread Alexnb
Okay, so lets say you have a list: funList = [1,2,3,4,5] and you do: for x in funList: print x this will print 1-5 But I am wondering is there a way to something like this: funString = "string string string non-string non-string string" and for "string" in funString: print somethi

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
Ya just an example, to print the numbers 1-5 Fredrik Lundh wrote: > > Alexnb wrote: > >> But I am wondering is there a way to something like this: >> >> funString = "string string string non-string non-string string" >> and >> for "string

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
Basically I want the code to be able to pick out how many strings there are and then do something with each, or the number. When I say string I mean how many "strings" are in the string "string string string non-string string" Does that help? Fredrik Lundh wrote: > &

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
is after "yes". It is like the yeses are bullet points and I want all the info after them. However, all in one string. Fredrik Lundh wrote: > > Alexnb wrote: > >> Basically I want the code to be able to pick out how many strings there >> are >> and then do so

searching through a string and pulling characters

2008-08-18 Thread Alexnb
This is similar to my last post, but a little different. Here is what I would like to do. Lets say I have a text file. The contents look like this, only there is A LOT of the same thing. () A registry mark given by underwriters (as at Lloyd's) to ships in first-class condition. Inferior grades

Re: searching through a string and pulling characters

2008-08-18 Thread Alexnb
probably won't work, but that is the Idea. Also, on a side-note, does anyone know a very simple dictionary site, that isn't dictionary.com or yourdictionary.com. Or, a free dictionary that I can download to have an offline reference? John Machin wrote: > > On Aug 19, 6:40 am, Alexnb

Re: searching through a string and pulling characters

2008-08-18 Thread Alexnb
? Anyway, Ideas? John Machin wrote: > > On Aug 19, 8:34 am, Alexnb <[EMAIL PROTECTED]> wrote: > >> The number is based on the word(s) they type into my program, and then it >> fetches the number that word is in the list of words and then will search >> the definit

simple Question about using BeautifulSoup

2008-08-20 Thread Alexnb
Okay, I have used BeautifulSoup a lot lately, but I am wondering, how do you open a local html file? Usually I do something like this for a url soup = BeautifulSoup(urllib.urlopen('http://www.website.com') but the file extension doesn't work. So how do I open one? -- View this message in conte