Tuesday, May 31, 2011

Re: python code works in command line but not in django

Hi Bruno,

I tested with both system's python shell and the "manage.py shell",
and both of them also worked. The PNG file was created properly.

I also check the path returned from os.path.abspath() and both of them
are ok as well.

Now I am testing using the Django embedded development server.

Kann

On May 31, 12:19 pm, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> On May 31, 11:29 am, Kann <vearas...@gmail.com> wrote:
>
> > Hi All,
>
> > I apologize for now being specific enough. The java script
>
> s/script/application/
>
> Please let's not confuse Java with javascript ;)
>
> > should read
> > files in "tmp/medusa" and use "Medusa.jar" as the referenced class to
> > run. The result of the script should be a png image using data from
> > files inside "tmp/medusa"
>
> > I tested the java command via terminal and it worked fine. The PNG
> > image was created correctly.
>
> > I tested the python package using python shell
>
> bare python shell, or ./manage.py shell ?
>
> > by importing
> > MedusaConnector and run the "MedusaConnector.create_image()", and the
> > PNG image was created properly as well.
>
> > Therefore, I imported the Medusa package into my views.py and try to
> > run it using django. This time, the PNG file was created, but with and
> > empty image unlike those 2 previous test cases.
>
> > Really have no idea what's going on here...
>
> Check you path. FWIW:
>
> Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import os
> >>> os.getcwd()
> '/home/bruno'
> >>> os.path.abspath('tmp')
> '/home/bruno/tmp'
> >>> os.chdir('/home')
> >>> os.path.abspath('tmp')
> '/home/tmp'
>
> Also are you running Django with the embedded development server (./
> manage.py runserver) or behind Apache or another front web server ? In
> the second case, you may have issues with ENV, perms etc.
>
> HTH

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment