Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6536075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:26:54+00:00 2026-05-25T10:26:54+00:00

Some system/software info before getting started: OS: Mac OS X 10.7.1 Python: Active Python

  • 0

Some system/software info before getting started:

OS: Mac OS X 10.7.1

Python: Active Python 2.7.2.5

wxPython: wxPython2.9-osx-2.9.1.1-cocoa-py2.7

I have a small wxpython-based Mac app that just tests the availability of cvs and svn on a Mac platform. This is the python code on which the Mac app is based:

import wx
import commands,os

ID_RUN_BUTTON=1
class Frame(wx.Frame):
    def __init__(self, parent, id, title):
          wx.Frame.__init__(self, parent, id, title, size=(100, 100),style=wx.MINIMIZE_BOX | wx.CLOSE_BOX)
          self.run_button=wx.Button(self,ID_RUN_BUTTON,label='Run')
          self.Bind(wx.EVT_BUTTON, self.OnRun,id=ID_RUN_BUTTON)
          self.Centre()
          self.Show()

    def OnRun(self,evt):
          home_dir=os.path.expanduser("~")
          a=commands.getoutput("cvs")
          b=commands.getoutput("svn help")
          f=open('%s/cvs_test' % (home_dir),'w')
          f.write(a)
          f.write('\n')
          f.write(b)
          f.close()

if __name__ == '__main__':
    app = wx.App(redirect=False)
    frame = Frame(None, -1, 'CVS Tester')
    app.MainLoop()

Here is a screen shot of this simple GUI with one button called ‘Run’.

screen shot of the simple cvs test app with a single 'Run' button

On pressing ‘Run’ it executes the OnRun method and it saves the output of the two commands ‘cvs’ and ‘svn help’ into a file called ‘cvs_test’ in the user’s home directory. When I run this code using the python interpreter on command-line, the output of both the commands is spit into a text file. Both cvs and svn commands are recognized and the output in the file cvs_test is as expected.

Now the problem is when I create a Mac app using py2app with the following script:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['cvs_test.py']
DATA_FILES = [('icons',['./icons/ark-2.png'])]
OPTIONS = {'iconfile': './icons/ark-2.icns'}

setup(app=APP,data_files=DATA_FILES,options={'py2app': OPTIONS},setup_requires=['py2app'])

The Mac app is created absolutely fine. But, when I open the Mac app and hit the ‘Run’ button, in the cvs_test file it created, it says:

“sh: cvs: command not found“

The Mac app is obviously running the same script but it couldn’t find the cvs command.

In my home directory, the following are the contents of my .profile file:

export TERM="xterm"
export PATH='/Developer/usr/bin':$PATH
export PATH='/usr/local/bin':$PATH

I added the path ‘/Developer/usr/bin’ by following a trick posted on Apple forums (click here) to resolve the cvs issue on OS X Lion.

What causes the python script to identify cvs when run from command-line and not identify it when the same script is run as a compiled Mac app ?

This question is killing me. My bash and the sh both of them can find cvs when run from the terminal, but the Mac app can’t. Any suggestions would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:26:54+00:00Added an answer on May 25, 2026 at 10:26 am

    When you run a OSX GUI app from Finder/Dock ie not the terminal a new shell is not started thus your .profile is not read.

    You can set environment variables in ~/.MacOS/environment.plist as per Apple doc

    You could also set the environment (e.g. add to the path) or explicitly use the full paths to cvs and svn in the python script

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started using Git as my version control system for some Cocoa projects
For some reason the system admin changed my user name from XxXx to XxXx1
I'm needing to cache some data using System.Web.Caching.Cache . Not sure if it matters,
I have inherited a middle tier system with some multi-Threading issues. Two different threads,
For my university assignment I have to design some basic managment system for sicknesses
The system I am currently working on requires some role-based security, which is well
Is there some means of querying the system tables to establish which tables are
Looking at some code I'm maintaining in System Verilog I see some signals that
Searching for some sample code for converting a point in WGS84 coordinate system to
On a small embedded system project we have some code which we would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.