Re: basic code of what I am doing [was problems with opening files due to file's path]

2008-06-11 Thread Ethan Furman
Alexnb wrote: > 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. > -- http://mail.python.org/mailman/listinfo/python-list

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 inab

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

2008-06-11 Thread Alexnb
Well, I don't understand why I don't need to change anything because say I run that code, which goes straight from the entry box to the startfile() function. It doesn't work with some of the paths, that is the whole problem. the problem is when I enter a path with those certain characters next to

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

2008-06-11 Thread Carsten Haese
Alexnb wrote: I don't get why yall are being so rude about this. We're frustrated with your apparent inability to understand anything we're saying. 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 w

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

2008-06-11 Thread Jerry Hill
On Wed, 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 wrong. But it will look somehting like this: Wha

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

2008-06-11 Thread Alexnb
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, or, with all the backslashes doubled. Thats it, I'll

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

2008-06-11 Thread Alexnb
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 wrong. But it will look somehting like this: e = Entry() #when user hits submit) path = e.get() os.startfile(path) this

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

2008-06-11 Thread Grant Edwards
On 2008-06-11, Alexnb <[EMAIL PROTECTED]> wrote: > Okay, so as a response to all of you, I will be using the Entry() widget in > Tkinter to get this path. OK. > and the repr() function just makes all my backslashes 4 > instead of just 1, and it still screwes it up with the numbers > and parenthe

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

2008-06-11 Thread Thomas Morton
what your describing: what you have could be totally different :) Post-da-code :) Tom -- From: "Carsten Haese" <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2008 7:05 PM Newsgroups: comp.lang.python To: Subject: Re: problems with o

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

2008-06-11 Thread Carsten Haese
Alexnb wrote: 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 kno

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 Lie
On Jun 11, 9:14 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > Lie wrote: > > In most GUI toolkits (including Tkinter) and raw_input() function, > > when you input a string (using the textbox, a.k.a Entry widget) it > > would automatically be escaped for you, so when you input 'path\path > > \file.

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

2008-06-11 Thread Carsten Haese
Lie wrote: In most GUI toolkits (including Tkinter) and raw_input() function, when you input a string (using the textbox, a.k.a Entry widget) it would automatically be escaped for you, so when you input 'path\path \file.txt', the GUI toolkit would convert it into 'path\\path\ \file.txt'. That's

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

2008-06-11 Thread Lie
On Jun 11, 10:07 am, Alexnb <[EMAIL PROTECTED]> wrote: > 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

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

2008-06-11 Thread Carsten Haese
Alexnb wrote: I don't think you understand it doesn't matter how the variable gets there But it *does* matter. Compare this: py> filename = "C:\Somewhere\01 - Some Song.mp3" py> print filename C:\Somewhere - Some Song.mp3 To this: py> filename = raw_input("Enter the filename: ") Enter the fi

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-10 Thread Grant Edwards
On 2008-06-11, Alexnb <[EMAIL PROTECTED]> wrote: path = "C:\Documents and Settings\Alex\My Documents\My Music\Rhapsody\Bryanbros\Jason Mraz\I'm Yours (Single)\01 - I'm Yours.wma" Your string doesn't contain what you think it does. Do a "print path". Hint: the string "\01" consist

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

2008-06-10 Thread Carsten Haese
Alexnb wrote: Okay, I don't understand how it is too vague, but here: > [snip a bunch of irrelevant examples...] Did I clarify? No. Earlier you 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

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

2008-06-10 Thread Alexnb
Okay, I don't understand how it is too vague, but here: >>> path = "C:\Documents and Settings\Alex\My Documents\My >>> Music\Rhapsody\Bryanbros\Jason Mraz\I'm Yours (Single)\01 - I'm >>> Yours.wma" >>> os.startfile(path) Traceback (most recent call last): File "", line 1, in os.startfile(p

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

2008-06-10 Thread Grant Edwards
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 of a file, > either .wma or .mp3 and is supposed to open it. I run

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

2008-06-10 Thread Alexnb
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 of a file, either .wma or .mp3 and is supposed to open it. I run into problems when there is either a ")" or a number next

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

2008-06-10 Thread Mike Driscoll
On Jun 10, 1:57 pm, Alexnb <[EMAIL PROTECTED]> wrote: > That would work, but not for what I want. See the file could be anywhere on > the user's system and so the entire path will be unique, and that didn't > work with a unique path. What is the subprocess module you are talking > about? > As C

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

2008-06-10 Thread Mike Driscoll
On Jun 10, 2:09 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > Alexnb wrote: > > No this time it perhaps gave me the worst of all heres what I entered, and > > the output > > startfile(r"%s"%full)    ***full is the path*** > > > startfile(r"%s"%full) > > > WindowsError: [Error 2] The system ca

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

2008-06-10 Thread Carsten Haese
Alexnb wrote: No this time it perhaps gave me the worst of all heres what I entered, and the output startfile(r"%s"%full)***full is the path*** startfile(r"%s"%full) WindowsError: [Error 2] The system cannot find the file specified: '"C:\\Documents and Settings\\Alex\\My Documents\\My Mu

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

2008-06-10 Thread Thomas Morton
he file definitely exist? Tom -- From: "Alexnb" <[EMAIL PROTECTED]> Sent: Tuesday, June 10, 2008 7:37 PM To: Subject: Re: problems with opening files due to file's path No this time it perhaps gave me the worst of all heres what I entered

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 Mike Driscoll
rguments, than you'll want to use the subprocess module instead. > > -- > From: "Alexnb" <[EMAIL PROTECTED]> > Sent: Tuesday, June 10, 2008 7:05 PM > To: <[EMAIL PROTECTED]> > Subject: Re: problems with opening files due to file's path > >

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 Thomas Morton
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]> Sent: Tuesday, June 10, 2008 7:05 PM To: Subject:

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

2008-06-10 Thread Alexnb
Well, now i've hit another problem, this time being that the path will be a variable, and I can't figure out how to make startfile() make it raw with a variable, if I put startfile(r variable), it doesn't work and startfile(rvariable) obviously won't work, do you know how to make that work or bett

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

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

2008-06-10 Thread Mike Driscoll
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, and for this we will say it is an .mp3. Well, I am using the > >> system() command from the os class. [...] >

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

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

2008-06-10 Thread Gerhard Häring
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\Rhapsody\Bryanbros\Weezer\(2001)\04

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