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

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(\C:\Documents and Settings\Alex\My Documents\My Music

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 want my program to do it open a file, a music file in specific

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

2008-06-10 Thread Alexnb
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: Okay, so what I want my program to do it open a file, a music file in specific

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

2008-06-10 Thread Alexnb
\\Bryanbros\\Jason Mraz\\I\'m Yours (Single)\x01 - I\'m Yours.wma' Thomas Morton wrote: maybe try string substitution... not sure if that's really the BEST way to do it but it should work startfile(r%s%variable) -- From: Alexnb [EMAIL PROTECTED

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

2008-06-10 Thread Alexnb
' % username) or os.startfile(r'C:\Program Files\%s' % myApp) Hopefully this 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

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

2008-06-10 Thread Alexnb
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] wrote: That would work

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

2008-06-10 Thread Alexnb
\ into a \\ then it would also work. Did I clarify? Grant Edwards wrote: On 2008-06-11, Alexnb [EMAIL PROTECTED] wrote: I am using GUI, Tkinter to be exact. But regardless of how the path gets there, it needs to opened correctly. The problem I am running into is that the program receives a path

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: Alexnb 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

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

2008-06-11 Thread Alexnb
) 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() widget in Tkinter to get

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

2008-06-11 Thread Alexnb
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 response to all of you, I will be using the Entry

basic code of what I am doing

2008-06-11 Thread Alexnb
(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, creating escape characters I don't want, so I need a way to send the string to the os.startfile() in raw

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

2008-06-11 Thread Alexnb
to each other. Everyone seems like there is some huge thing that I am missing... and I don't know what it is, because when I run that code, with that path I was talking about, I get an error, and it shows me that it is because of the \0. Jerry Hill wrote: On Wed, Jun 11, 2008 at 4:16 PM, Alexnb

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 frustrated with your apparent inability

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

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

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

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 urllib2. I really have

Re: using urllib2

2008-06-27 Thread Alexnb
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 that, and it is kinda hard. But since you obviously know what you are doing, where did you

Re: using urllib2

2008-06-27 Thread Alexnb
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 that, and it is kinda hard. But since you obviously know what you are doing, where did you learn

Re: using urllib2

2008-06-27 Thread Alexnb
of the sole of the foot of a horse or related animal. '] HTH, Jeff On Jun 27, 7:28 pm, Alexnb [EMAIL PROTECTED] wrote: I have read that multiple times. It is hard to understand but it did help a little. But I found a bit of a work-around for now which is not what I ultimately want. However, even

Re: using urllib2

2008-06-29 Thread Alexnb
: 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 using pydev in eclipse), and I got these errors, any idea what is up? Traceback (most recent call last):   File /Users/Alex/Documents/workspace/beautifulSoup

Re: using urllib2

2008-06-29 Thread Alexnb
think it is the italics because one 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 http://www.goo

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 word simple don't show up

Re: using urllib2

2008-06-29 Thread Alexnb
'..etc. makes it a list. Do you think that has anything to do with the problem? Alexnb wrote: Actually after looking at this, the code is preactically the same, except the definitions. So what COULD be going wrong here? Also, I ran the program and decided to print the whole list

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:

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 x = [1] x[2] = 4 Traceback (most recent call last

Re: Problem with a for loop and a list

2008-07-02 Thread Alexnb
: 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[self.n] = entry.get() And what does self.wordList begin as? If {}, then the assignemt

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:

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

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

Help with BeautifulSoup

2008-07-11 Thread Alexnb
Okay, heres the general idea of the html I have to work with: div noun table class='luna' table class='luna' table class='luna' table class='luna' verb table class='luna' table class='luna' table class='luna' /div Okay, I left off some stuff. But what I need to do is

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: div noun table class='luna' table class='luna' table class='luna' table class='luna' verb table class='luna' table class='luna' table class='luna' /div Okay, I

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.org/python/py2app.html http://effbot.org/pyfaq/how-do-i-create-a-pyc

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

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 single entity. Do you mean some particular internet host

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 websites (Yahoo, Google, etc.)? If all of them are failing, it's very

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

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 program stops. So I don't

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 out how to test if the user is able to connect to a specific website. Last time I got pointed

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 == '': print good to go footnote: here's a better way to test if an exception was raised or not: try

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

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 windows. However, the pictures are stored in the same

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 program has a few pictures involved and the .ico it uses for the windows. However, the pictures

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

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:

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-list I'm sorry, I

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('%s' % l if i % 2 == 1 else l for i, l in enumerate(s.split('--'))) ' /browse/brick brick ' I'm sorry, I don't think I was being clear. I replaced

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' hello[0] == False hello[0] == h True hello.startswith(h) True Bye, bearophile -- http://mail.python.org

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:

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 care

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:

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 something

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 in funString: print something I know you can't do

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: Alexnb wrote: Ya just

Re: like a for loop for a string

2008-08-17 Thread Alexnb
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 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

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
. 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 [EMAIL PROTECTED] wrote: This is similar to my last post

Re: searching through a string and pulling characters

2008-08-18 Thread Alexnb
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 definitions document and go to the nth def. It probably won't work

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