473,545 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

basic code of what I am doing


Okay, so I wrote some code of basically what I will be doing, only with
exactly what I need for this part of the program but here you go:

[code]

from Tkinter import*
import os

class myApp:
def __init__(self, parent):
self.parent = parent

self.baseContai ner = Frame(self.pare nt)
self.baseContai ner.pack()

self.e = Entry(self.base Container)
self.e.bind("<R eturn>", self.entryEnter )
self.e.pack()

self.Button1 = Button(self.bas eContainer, command =
self.buttonClic k)
self.Button1.co nfigure(text="S ubmit")
self.Button1.pa ck()
def buttonClick(sel f):
print "Button1 was clicked"
path = self.e.get()
path = "\"" + path + "\""
os.startfile(pa th)

def entryEnter(self , event):
print "Enter was hit in the entry box"
self.buttonClic k()
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, 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 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 <al********@gma il.comwrote:
>>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 parenthesis is has been since the first post.

I've absolutely no clue why you would be using the repr()
function.
>>Oh and I know all about escape characters, (\n,\b,\a,etc.)

Apparently not.
>>I can program C, not a lot, but enough to know that I like
python better. Anyway, so far I tried all of your stuff, and
it didn't work.

To what does "it" refer?
>>infact, it puts backslashes in front of the
"'" in some of the words, such as "I'm" goes to "I\'m."

Again, "it" doesn't seem to have a concrete referant.
>>So I posted the code I will be using if you want to see the
Tkinter code I can post it, but I don't see how it will help.

If you know what would help and what wouldn't, then you must
know enough to fix your problems. So please do so and quit
bothering the newgroup.

--
Grant Edwards grante Yow! I want another
at RE-WRITE on my CEASAR
visi.com SALAD!!
--
http://mail.python.org/mailman/listinfo/python-list


--
View this message in context: http://www.nabble.com/problems-with-opening-files-due-to-file%27s-path-tp17759531p1778 6712.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Jun 27 '08 #1
1 1135
Alexnb <al********@gma il.comwrote:
path = self.e.get()
path = "\"" + path + "\""
os.startfile(pa th)
Why are you adding spurious quote marks round the filename? os.startfile()
will strip them off, but you don't need them. The help for os.startfile()
does say though that the path must not start with a /, so you should use
os.normpath to be on the safe side:

os.startfile(os .path.normpath( self.e.get())

Anyway, the code works either with that change, or as you originally wrote
it provided the path does not start with /. What was the question again?
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1757
by: Frantisek Fuka | last post by:
This thing keeps bugging me. It's probably some basic misunderstanding on my part but I am stumped. Let's say I have two Python files: file.py and file2.py. Their contents is as follows: file.py: --------------------- import file2 def hello(): print "Hello" file2.hello2()
7
9267
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. # No warranty express or implied for the accuracy, fitness to purpose
10
1849
by: Jason Curl | last post by:
Greetings, I have an array of 32 values. This makes it extremely fast to access elements in this array based on an index provided by a separate enum. This array is defined of type "unsigned long int". I have a typedef for this: typedef unsigned long int Uint32; typedef float Float32; Uint32 myArray;
4
2215
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time process? 2. What information contained in sn key. I gone through that it is having public key. How it is using this key to intract with client....
4
1282
by: Mark Linehan | last post by:
Greetings and salutations. I began programming God knows how many years ago in basic on the Commodore 64. I dabbled in a little assembly as well. I moved on to the PC eventually and stuck with basic under DOS and some C,C++ as well. Had a lot of fun. Concentrated mostly in the area of communications via modem, BBS's and that sort of thing....
4
257
by: CSharpguy | last post by:
I'm not sure if this is the correct forum or not, but I have a basic question. Currently we have are doing calculations via stored procedures and then returning the results back to the client in either a web page or a winForm style application. There are times that the stored procedure takes 20 minutes or 3 hours to run. Now, our database...
4
1715
by: MikeB | last post by:
I've been all over the net with this question, I hope I've finally found a group where I can ask about Visual Basic 2005. I'm at uni and we're working with Visual Basic 2005. I have some books, - Programming Visual Basic by Balena (MS Press) and - Visual Basic 2005 by Willis (WROX), but they don't go into the forms design aspects and...
0
15982
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I am currently working on the application that need to simulate basic authentication programmatically using user's credentials that are known. Basically, the need is for a single sign on with a third party application. The scenario is the following: a third party application (iChain I believe, from Novell) is used to authenticate the user...
6
3134
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and manufactured. I got my printed circuit board back and populated it with components. On my circuit board, I have a chip holder for a Basic STAMP...
6
38467
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL...
0
7487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7446
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.