librelist archives

« back to archive

Cannot open file in write mode

Cannot open file in write mode

From:
Shane Cleveland
Date:
2012-07-04 @ 18:55
I am able to open and read a text file like this:

	index_file = 'path/to/file.txt'
	f = open(index_file, 'r')

But I cannot open it using the write mode ('w') or any other mode. I just 
get a 500 Internal Server Error.

Any idea why?

Thanks for any input.

Re: [flask] Cannot open file in write mode

From:
Anthony Ford
Date:
2012-07-04 @ 18:57
Verify that you have write permissions to that file. You can chmod the file
temporarily with 777 and see if that fixes things.

Anthony Ford,
ford.anthonyj@gmail.com,
Research Assistant,
Center for Advanced Radio Astronomy,
University of Texas - Brownsville
On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:

> I am able to open and read a text file like this:
>
>         index_file = 'path/to/file.txt'
>         f = open(index_file, 'r')
>
> But I cannot open it using the write mode ('w') or any other mode. I just
> get a 500 Internal Server Error.
>
> Any idea why?
>
> Thanks for any input.
>

Re: [flask] Cannot open file in write mode

From:
Shane Cleveland
Date:
2012-07-04 @ 19:16
Thanks for the suggestion, but still does not work with 777 permission.

On Jul 4, 2012, at 11:57 AM, Anthony Ford wrote:

> Verify that you have write permissions to that file. You can chmod the 
file temporarily with 777 and see if that fixes things.
> 
> Anthony Ford,
> ford.anthonyj@gmail.com,
> Research Assistant,
> Center for Advanced Radio Astronomy,
> University of Texas - Brownsville
> 
> On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:
> I am able to open and read a text file like this:
> 
>         index_file = 'path/to/file.txt'
>         f = open(index_file, 'r')
> 
> But I cannot open it using the write mode ('w') or any other mode. I 
just get a 500 Internal Server Error.
> 
> Any idea why?
> 
> Thanks for any input.

Re: [flask] Cannot open file in write mode

From:
Anthony Ford
Date:
2012-07-04 @ 19:18
Which os see you running on?

Anthony Ford,
ford.anthonyj@gmail.com,
Research Assistant,
Center for Advanced Radio Astronomy,
University of Texas - Brownsville
On Jul 4, 2012 1:17 PM, "Shane Cleveland" <shane@benik.com> wrote:

> Thanks for the suggestion, but still does not work with 777 permission.
>
> On Jul 4, 2012, at 11:57 AM, Anthony Ford wrote:
>
> Verify that you have write permissions to that file. You can chmod the
> file temporarily with 777 and see if that fixes things.
>
> Anthony Ford,
> ford.anthonyj@gmail.com,
> Research Assistant,
> Center for Advanced Radio Astronomy,
> University of Texas - Brownsville
> On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:
>
>> I am able to open and read a text file like this:
>>
>>         index_file = 'path/to/file.txt'
>>         f = open(index_file, 'r')
>>
>> But I cannot open it using the write mode ('w') or any other mode. I just
>> get a 500 Internal Server Error.
>>
>> Any idea why?
>>
>> Thanks for any input.
>>
>
>

Re: [flask] Cannot open file in write mode

From:
Shane Cleveland
Date:
2012-07-04 @ 19:26
I actually just got it working on my live hosting environment. It's my 
development environment that it's not working on. I'm on OSX 10.7. I have 
my site set up in a virtual host. Could it be a folder permission issue, 
as opposed to a file permission issue?

Any suggestion on the permissions I should use?

Thanks,

Shane

On Jul 4, 2012, at 12:18 PM, Anthony Ford wrote:

> Which os see you running on?
> 
> Anthony Ford,
> ford.anthonyj@gmail.com,
> Research Assistant,
> Center for Advanced Radio Astronomy,
> University of Texas - Brownsville
> 
> On Jul 4, 2012 1:17 PM, "Shane Cleveland" <shane@benik.com> wrote:
> Thanks for the suggestion, but still does not work with 777 permission.
> 
> On Jul 4, 2012, at 11:57 AM, Anthony Ford wrote:
> 
>> Verify that you have write permissions to that file. You can chmod the 
file temporarily with 777 and see if that fixes things.
>> 
>> Anthony Ford,
>> ford.anthonyj@gmail.com,
>> Research Assistant,
>> Center for Advanced Radio Astronomy,
>> University of Texas - Brownsville
>> 
>> On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:
>> I am able to open and read a text file like this:
>> 
>>         index_file = 'path/to/file.txt'
>>         f = open(index_file, 'r')
>> 
>> But I cannot open it using the write mode ('w') or any other mode. I 
just get a 500 Internal Server Error.
>> 
>> Any idea why?
>> 
>> Thanks for any input.
> 

Re: [flask] Cannot open file in write mode

From:
Devon Stewart
Date:
2012-07-04 @ 19:33
Many people make the mistake of overlooking who owns the file, choosing 
instead to use 777 permissions; do a (or `id') to find your user, then 
make sure you own that directory using ls -dl <directory>

-Devon

On Jul 4, 2012, at 12:26, Shane Cleveland <shane@benik.com> wrote:

> I actually just got it working on my live hosting environment. It's my 
development environment that it's not working on. I'm on OSX 10.7. I have 
my site set up in a virtual host. Could it be a folder permission issue, 
as opposed to a file permission issue?
> 
> Any suggestion on the permissions I should use?
> 
> Thanks,
> 
> Shane
> 
> On Jul 4, 2012, at 12:18 PM, Anthony Ford wrote:
> 
>> Which os see you running on?
>> 
>> Anthony Ford,
>> ford.anthonyj@gmail.com,
>> Research Assistant,
>> Center for Advanced Radio Astronomy,
>> University of Texas - Brownsville
>> 
>> On Jul 4, 2012 1:17 PM, "Shane Cleveland" <shane@benik.com> wrote:
>> Thanks for the suggestion, but still does not work with 777 permission.
>> 
>> On Jul 4, 2012, at 11:57 AM, Anthony Ford wrote:
>> 
>>> Verify that you have write permissions to that file. You can chmod the
file temporarily with 777 and see if that fixes things.
>>> 
>>> Anthony Ford,
>>> ford.anthonyj@gmail.com,
>>> Research Assistant,
>>> Center for Advanced Radio Astronomy,
>>> University of Texas - Brownsville
>>> 
>>> On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:
>>> I am able to open and read a text file like this:
>>> 
>>>         index_file = 'path/to/file.txt'
>>>         f = open(index_file, 'r')
>>> 
>>> But I cannot open it using the write mode ('w') or any other mode. I 
just get a 500 Internal Server Error.
>>> 
>>> Any idea why?
>>> 
>>> Thanks for any input.
>> 
> 

Re: [flask] Cannot open file in write mode

From:
Shane Cleveland
Date:
2012-07-04 @ 19:32
Thank for your help. I was able to give more permission to the folder 
housing the file. Worked fine. Knew it had to be something simple!

Shane

On Jul 4, 2012, at 12:26 PM, Shane Cleveland wrote:

> I actually just got it working on my live hosting environment. It's my 
development environment that it's not working on. I'm on OSX 10.7. I have 
my site set up in a virtual host. Could it be a folder permission issue, 
as opposed to a file permission issue?
> 
> Any suggestion on the permissions I should use?
> 
> Thanks,
> 
> Shane
> 
> On Jul 4, 2012, at 12:18 PM, Anthony Ford wrote:
> 
>> Which os see you running on?
>> 
>> Anthony Ford,
>> ford.anthonyj@gmail.com,
>> Research Assistant,
>> Center for Advanced Radio Astronomy,
>> University of Texas - Brownsville
>> 
>> On Jul 4, 2012 1:17 PM, "Shane Cleveland" <shane@benik.com> wrote:
>> Thanks for the suggestion, but still does not work with 777 permission.
>> 
>> On Jul 4, 2012, at 11:57 AM, Anthony Ford wrote:
>> 
>>> Verify that you have write permissions to that file. You can chmod the
file temporarily with 777 and see if that fixes things.
>>> 
>>> Anthony Ford,
>>> ford.anthonyj@gmail.com,
>>> Research Assistant,
>>> Center for Advanced Radio Astronomy,
>>> University of Texas - Brownsville
>>> 
>>> On Jul 4, 2012 12:55 PM, "Shane Cleveland" <shane@benik.com> wrote:
>>> I am able to open and read a text file like this:
>>> 
>>>         index_file = 'path/to/file.txt'
>>>         f = open(index_file, 'r')
>>> 
>>> But I cannot open it using the write mode ('w') or any other mode. I 
just get a 500 Internal Server Error.
>>> 
>>> Any idea why?
>>> 
>>> Thanks for any input.
>> 
>