Hi Ryan,

Thanks a lot for your script, it made my day. Just yesterday I wasted a couple of hours trying to find a way to add environment variables to our app.

I really missed your code the first time but now I added it (with due credit of course) to our tree.

Thanks again,
Carlos

El 05/03/13 13:21, mrclary escribió:
If I understand your problem correctly:
1. you have the executable path /usr/local/bin/ffmpeg
2. your script executes successfully if run in a python (or ipython) interpreter started from the terminal 3. your script executes unsuccessfully if run from within Spyder (standalone app)

If the above is correct, then I think I know what the problem is.
When Spyder is started, the interpreter inherits the following system PATH:

In[6]: os.environ['PATH']
Out[6]: '/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Spyder.app/Contents/Resources'

which does not include '/usr/local/bin'

I have run into this problem before and found one solution is to modify the system path in the interpreter's startup script. I've attached the startup script that I use. The script captures the environment variables from a standard terminal session, including any statements contained in your bash profile scripts. On my system I use ~/.profile and /etc/profile for my bash profiles, but if you use something else (e.g. bashrc, bash_profile, etc.) you will want to modify the attached script appropriately. In Spyder's preferences, specify the attached script as the startup script.

Your system path (os.environ['PATH']) in Spyder should now match your PATH environment variable in a Terminal session (echo $PATH), and scripts run from within Spyder should be able to find any executables in '/usr/local/bin'.

Ryan Clary

On Friday, March 1, 2013 4:04:53 AM UTC-8, Laurent PARISE wrote:

    Excuse me for my English first.

    I use Mac OS 10.6.8 Spyder for some time with great pleasure.
    Thank you for your work!
    However, since yesterday I have a problem with creating animations
    (MP4) with matplotlib.

    1. My script works from the command line (and make an mp4 file),
    but I get an error in Spyder with the same script:

    
/Applications/Spyder.app/Contents/Resources/lib/python2.7/matplotlib/animation.py:
    598:
    UserWarning: ffmpeg MovieWriter unavailable
    warnings.warn ("% s MovieWriter unavailable" writer%)

    It seems that Spyder's Python can not find the'ffmpeg' program
    that creates the MP4 file.

    2. I did some tests: if I start Spyder in the console command
    line, my script is compiled correctly in Spyder ! But if I start
    Spyder by clicking on the icon in the Applications folder, python
    does not find 'ffmpeg' that isin '/usr/local/bin'.

    In fact, '/usr/local/bin' is in myPATH in the console (I type
    'env' in the console to see it), but Spyder do not know if I run
    it from the Applications folder...

    Could you tell me if it is possible to tell Spyder, it must use
    the PATH variable to launch external programs (if my problem is it)?


    Thanks again.
    Laurent.

--
You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to