Re: Python Django Latex Permissions Problem

2008-11-28 Thread I-T
It was a very unlikely problem. Apparently although apache was
configured, someone in the past had run some instances of manage.py
Maybe they were stuck or they were running in the background.

Once all python instances were killed and Apache was restarted,
everything worked as a breeze.

Thanks for the help though

On Nov 25, 2:30 pm, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> I-T <[EMAIL PROTECTED]> wrote:
> >  I have a python/django webapp running with apache2. It executes system
> >  commands for getting a pdf generated by pdflatex from a .tex file and
> >  a couple of image files which it also generates.
>
> >  The permssions from ls-l for all the created files is:-
> >  -rw-r--r-- 1 www-data www-data
>
> >  The files are being created in /tmp/pdfscratch{id} created from the
> >  script and so is the directory.
>
> >  pdflatex fails with the following error message:-
>
> >  This is pdfTeXk, Version 3.141592-1.40.3 (Web2C  7.5.6)
> >   %&-line parsing enabled.
> >  entering extended mode
> >  ! I can't write on file `uber.log'.
> >  Please type another transcript file name:
> >  ! Emergency stop
> >  !  ==> Fatal error occurred, no output PDF file  produced!
>
> >  Its supposed to write to this directory. I have a feeling that
> >  pdflatex is trying to generate files using some weird access
> >  credentials that dont have access to /tmp/pdfscratch{id}
>
> Unlikely - it takes root to change user and I wouldn't have thought
> any of the files would be setuid.
>
> Try chdir to /tmp/pdfscratch{id} first would be my suggestion.
>
> --
> Nick Craig-Wood <[EMAIL PROTECTED]> --http://www.craig-wood.com/nick

--
http://mail.python.org/mailman/listinfo/python-list


Python Django Latex Permissions Problem

2008-11-24 Thread I-T
I have a python/django webapp running with apache2. It executes system
commands for getting a pdf generated by pdflatex from a .tex file and
a couple of image files which it also generates.

The permssions from ls-l for all the created files is:-
-rw-r--r-- 1 www-data www-data

The files are being created in /tmp/pdfscratch{id} created from the
script and so is the directory.

pdflatex fails with the following error message:-

This is pdfTeXk, Version 3.141592-1.40.3 (Web2C  7.5.6)
 %&-line parsing enabled.
entering extended mode
! I can't write on file `uber.log'.
Please type another transcript file name:
! Emergency stop
!  ==> Fatal error occurred, no output PDF file  produced!

Its supposed to write to this directory. I have a feeling that
pdflatex is trying to generate files using some weird access
credentials that dont have access to /tmp/pdfscratch{id}

What do you guys think could be the problem/solution

Thanks in advance
--
http://mail.python.org/mailman/listinfo/python-list


Re: write to specific line in file?

2008-05-16 Thread I-T
Open the file inside your script in append mode.

open('filename', 'wa')


On May 16, 11:41 pm, globalrev <[EMAIL PROTECTED]> wrote:
> i ahve a program that takes certain textsnippets out of one file and
> inserts them into another.
>
> problem is it jsut overwrites the first riow every time.
>
> i want to insert every new piece of text into the next row.
> so:
> 1. how do i write to a new line every time i write to the file?
>
> 2. if i dont want to write to a new line but just want to insert it
> after the last token in the file, how do i do then?

--
http://mail.python.org/mailman/listinfo/python-list


Re: Making Variable Text Output More Pythonic?

2008-05-16 Thread I-T
A thousand apologies for my ignorance. I'll try not to get names mixed
up again in the future.

On May 16, 8:42 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> afrobeard <[EMAIL PROTECTED]> writes:
> > Arnaud's code wont work if self.opt1 is None, an empty list, an empty
> > tuple, False, etc, because all these evaluate to false. They wont
> > print the internal state of these variables. [Just an informational
> > notice, this may be the behavior you expect]
>
> ??? My suggestion is to get rid of attributes altogether and does not
> test any truth values.
>
>
>
> > Secondly, I'm not sure if you know the variable names from before hand
> > in which case Casey's approach will work, or you need to know them via
> > introspection.http://www.ibm.com/developerworks/library/l-pyint.html
> > [Scroll down to attributes].
>
> > On May 16, 1:44 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> >> Casey <[EMAIL PROTECTED]> writes:
> >> > Hi,
>
> >> > I have some classes that print variable outputs depending on their
> >> > internal state, like so:
>
> >> > def __str__(self):
> >> >     out = []
> >> >     if self.opt1: out += ['option 1 is %s' % self.opt1']
> >> >     if self.opt2: out += ['option 2 is %s' % self.opt2']
> >> >     
> >> >     return '\n'.join(out)
>
> >> > Is there any way to make this cleaner?
>
> >> Maybe.
>
> >> Have a dictionary of options rather than individual attributes;
> >> options not in the dictionary are not set. E.g.
>
> >> mask = {
> >>     'opt1': 'option 1 is %s',
> >>     'opt2': 'option 2 is %s',
> >>     ...
> >>     }
>
> >> def __str__(self):
> >>     return '\n'.join(mask[o] % v for o,v in self.options.iteritems())
>
> >> --
> >> Arnaud

--
http://mail.python.org/mailman/listinfo/python-list