I made a new folder /home/baker and then changed my write open() command to 
f = open('/home/baker/MyFile.txt', w) and the read open command to f = 
open('/home/baker/MyFile.txt', w) but still am not able to create and write 
to the MyFile.txt. Now the getcwd() command tells me that the cwd is 
/home/baker. Also not getting any error message even for writing or 
reading, just the exception to reading the file that it cannot find the 
file. No exception when I try to write to the file. I am running my Python 
program with sudo python myprogram.py. I tried changing the permissions to 
my /home/baker directory with "sudo chmod -R 777 /home/baker" but WinSCP 
still says the owner is root and still my Python program cannot write a 
text file to /home/baker.

So I'm at wits end (a short trip to be sure) and cannot figure out how to 
write the data file.
John

On Tuesday, April 5, 2016 at 4:46:17 PM UTC-7, John Baker wrote:
>
> Thanks Paul. 
> getcwd() tells me that my cwd is /home/debian/Desktop when I use f = 
> open('MyFile.txt', w). I am using Try/Except and not getting an exception 
> with the open() statement. Perhaps I can't write a text file to the 
> Desktop, but it seems like it should give me an error message.
> John
>
> On 4/5/2016 3:19 PM, Paul Wolfson wrote:
>
> python
> >>> import os
> >>> os.getcwd()
> 'home/pwolfson'
> >>>
>
>
> -------------------------------------------------
> Paul Wolfson, Ph.D., TX LPI, #A17473
> Dallas Legal Technology
> 3402 Oak Grove Avenue, Suite 300-A
> Dallas, Texas 75204-2353
>
>
> *214-257-0984 (Tel) 214-838-7220 (Fax) Send me an email. <javascript:>*
> -------------------------------------------------
> The contents of this email are confidential to the sender and the ordinary 
> user of the email address to which it was addressed, and may also be 
> privileged.  If you are not the addressee of the email, you may not copy, 
> forward, disclose or otherwise use it or any part of it in any form 
> whatsoever.  If you have received this email in error, please advise the 
> sender at  214-257-0984.  Thank you.
> -------------------------------------------------
>
> On Tue, Apr 5, 2016 at 6:13 PM, William Hermans <[email protected] 
> <javascript:>> wrote:
>
>> *That's what I figured William. As far as I can tell, I am doing the open 
>>> and write and read like I have with C and as described in 
>>> https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
>>>  
>>> <https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files>.
>>>  
>>> However, I am not getting any error message when I do the open for writing 
>>> and do the write, just that the file is not getting created and written. It 
>>> should be so straightforward but it's not working.*
>>>
>>
>> Does this file already exist ? You should check the documentation for the 
>> file write() method and see what all is required for the method to work 
>> correctly. Also, as I said I'm no python developer, but the code shown 
>> there is really bad form. There is no error checking on the file object 
>> when attempting the open() call. In C this would be done by checking the 
>> value of f, but I'm not even sure this is possible in python.
>>
>> So I'd attempt to help you trouble shoot this by writing code myself, 
>> here, and testing. But I'm very "allergic" to python. Or more correctly, 
>> I'm getting old, and set in my ways, and python just is not in my future 
>> plans. *ever* . . .
>>
>> On Tue, Apr 5, 2016 at 3:05 PM, John Baker < <javascript:>
>> [email protected] <javascript:>> wrote:
>>
>>> That's what I figured William. As far as I can tell, I am doing the open 
>>> and write and read like I have with C and as described in 
>>> https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files.
>>>  
>>> However, I am not getting any error message when I do the open for writing 
>>> and do the write, just that the file is not getting created and written. It 
>>> should be so straightforward but it's not working. 
>>> John
>>>
>>> On Tuesday, April 5, 2016 at 2:57:02 PM UTC-7, William Hermans wrote: 
>>>>
>>>> I'm not a python developer, but actually have done this many times in 
>>>> C. So I can tell you this with certainty. This is done no different than 
>>>> it 
>>>> is done on any Linux system.
>>>>
>>>> The point here is that you should go out and find any good python 
>>>> tutorial, that covers writing to a file, and follow it.
>>>>
>>>> On Tue, Apr 5, 2016 at 1:43 PM, John Baker <[email protected]> 
>>>> wrote:
>>>>
>>>>> I want to store a little data on the eMMC from my Python code. My 
>>>>> program is not getting errors when I try to write a very short data file 
>>>>> but it doesn't actually seem to write it as I cannot read it back. I am 
>>>>> using 
>>>>> f = open('MyFile.txt', w)
>>>>>
>>>>> or
>>>>> f = open('/home/debian/Desktop/MyFile.txt', w)
>>>>>
>>>>> or
>>>>> f = open('MyFile.txt', r)
>>>>>
>>>>> or
>>>>> f = open('/home/debian/Desktop/MyFile.txt', r)
>>>>>
>>>>> to open the file and am not getting any errors but Python is not 
>>>>> finding the file and I cannot find the file with a  search from WinSCP.
>>>>>
>>>>> So how to create a data file and where does it go?
>>>>>
>>>>> Thanks,
>>>>> John
>>>>> -- 
>>>>> For more options, visit <http://beagleboard.org/discuss>
>>>>> http://beagleboard.org/discuss
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "BeagleBoard" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> For more options, visit <https://groups.google.com/d/optout>
>>>>> https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> For more options, visit <http://beagleboard.org/discuss>
>>> http://beagleboard.org/discuss
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "BeagleBoard" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to <javascript:>[email protected] <javascript:>.
>>> For more options, visit <https://groups.google.com/d/optout>
>>> https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> For more options, visit http://beagleboard.org/discuss
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
> For more options, visit http://beagleboard.org/discuss
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/beagleboard/4eMyTYs_lnw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to