[Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)
Matt D
md123 at nycap.rr.com
Thu Jun 13 06:24:57 CEST 2013
On 06/12/2013 09:54 PM, Dave Angel wrote:
> On 06/12/2013 09:14 PM, Matt D wrote:
>> On 06/12/2013 09:02 PM, Dave Angel wrote:
>>> On 06/12/2013 08:46 PM, Matt D wrote:
>>>> On 06/12/2013 05:59 PM, Dave Angel wrote:
>>>>> On 06/12/2013 05:32 PM, Matt D wrote:
>>>
>>>
>>> <SNIP>
>>>>>> Hey,
>>>>>> if i put:
>>>>>>
>>>>>> self.logfile = open('logfile.csv', 'w')
>>>>>>
>>>>>> in the .py file, within the 'class TrafficPane', then shouldn't
>>>>>> logfile.csv be written to the directory the .py file is in? because
>>>>>> its
>>>>>> not there after running the program? Where should i look for it?
>>>>>> Thanks
>>>>>> Matt
>>>>>>
>>>>>
>>>>> It should put it in the current directory. That *may* be the
>>>>> directory
>>>>> the script is in, but not necessarily. It's easy to run something
>>>>> like:
>>>>>
>>>>> python somdir/myscript.py
>>>>>
>>>>> in which case the file would be in the parent directory to myscript.py
>>>>>
>>>>> Note that in some environments, the current directory is invisibly set
>>>>> to some convenient place. For example, when right-clicking on a
>>>>> script
>>>>> in Windows Explorer, they make the bald assumption that you want to
>>>>> set
>>>>> the current directory the same as the location of the script. That's
>>>>> about the worse place for it, but nevermind.
>>>>>
>>>>>
>>>>>
>>>> Yes, that was my assumption (even thought I am using linux); and right
>>>> again, it is a very inconvenient place for it to be. however in the
>>>> interest of speed of testing i figured i would make sure the log was
>>>> logging the way i want it to and then try to find some sort of wx wigit
>>>> to let the user of the gui name/save to desired location. meanwhile . .
>>>> . so you think it saved somewhere right?
>>>
>>> There are other ways a script might change the current directory. For
>>> example, some naive scripts use os.chdir()
>>>
>>> But how is it you don't know what the current directory was when the
>>> code ran? A simply pwd can tell you, if your prompt doesn't already
>>> reveal it.
>>>
>>>
>> i was assuming the file would write to where the .py file is located.
>> of course i know where that is because i put the file there but the
>> logfile.csv is not in there. i did a search in the file system and
>> nothing so i don't know what is going on here? guess keep looking? its
>> gota be here somewhere? no?
>>
>
> So is somebody else running your program? As I said before, how can you
> NOT know what your current directory (cwd) is when you ran the script?
> And again, the location of the script is irrelevant.
>
> No more offlist messages. This is a public forum, and I don't do private.
>
> DaveA
>
>
please pardon mailing you only. when i press reply your email and not
the list's email comes in. listen; i run another program in terminal in
home directory; that program uses the .py file in the python directory.
I already told you i found the file? why would someone else be running
the program?
More information about the Tutor
mailing list