Yes indeed. Python 2.7 in the Debian 3.8.13 bone50 on my BBB does flag the
error, telling me that *w* is not correct.
I'm not sure as I haven't gone back to my old code to try it again, but I
suspect my use of Try/Except sort of hid the error, just telling me that
the Try failed and not telling me exactly what the error was and I simply
assumed the error was in the name or path in the open command. Clearly I
should have just used the open command outside of the Try/Except and then
an error message would have popped up telling me that the *w *was
incorrect. Hopefully I have learned from this, first to double-check the
syntax and second to dig a little to find out why the open command (or
other command) didn't work. I continue to be embarrassed at this dumb
mistake but I am going on to probably make other mistakes. However, my code
is working perfectly, GUI and all, including writing a logfile to the eMMC.
Thanks for everyone's help. I certainly needed it.
John
On Thursday, April 14, 2016 at 2:39:15 PM UTC-7, Paul Wolfson wrote:
>
> modeString = "w"
> fileNameString = "out.txt"
> f = open(fileNameString, modeString)
> f.write("This is a test for text output.")
> f.close()
>
>
> On Thu, Apr 14, 2016 at 4:06 PM, Melk933 <[email protected] <javascript:>>
> wrote:
>
>> The Python on my machine throws up an error.
>> $ python testopen.py
>> Traceback (most recent call last):
>> File "testopen.py", line 1, in <module> f= open("T3.txt", w)
>> NameError: name 'w' is not defined
>>
>>
>> On Wednesday, April 13, 2016 at 8:34:57 AM UTC-7, mickeyf wrote:
>>>
>>> I'm not a Python developer either, 'though I know it is very popular of
>>> late. Does it say something about Python itself that it did not throw up a
>>> big error in your face when the quotes were omitted? Or is the problem
>>> elsewhere?
>>>
>>> On Wednesday, April 6, 2016 at 11:24:18 AM UTC-7, John Baker wrote:
>>>>
>>>> Gosh, how did I miss that, that the mode is a string. Well it had to be
>>>> something simple like that. Quoting the w and r fixed the problem. Very
>>>> embarrassing.
>>>> :-[
>>>> Thanks,
>>>> John
>>>>
>>>>
>>>>
>
--
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.