Global join function?

2012-03-14 Thread Darrel Grant
In the virtualenv example bootstrap code, a global join function is used.

http://pypi.python.org/pypi/virtualenv

subprocess.call([join(home_dir, 'bin', 'easy_install'),
 'BlogApplication'])


In interpeter, I tried this:

 [join([], 'bin', 'easy_install')]
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'join' is not defined

I think I've seen this used elsewhere, but googling only seems to show
results about the string method join, not whatever this is.

To be clear, I understand how to use .join(list), but have not found
any information about this other, seemingly global, join function
which takes multiple arguments. It's been bugging me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Global join function?

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 18:41:27 UTC, Darrel Grant  wrote:
 In the virtualenv example bootstrap code, a global join function is used.
 
 http://pypi.python.org/pypi/virtualenv
 
 subprocess.call([join(home_dir, 'bin', 'easy_install'),
  'BlogApplication'])
 
 
 In interpeter, I tried this:
 
  [join([], 'bin', 'easy_install')]
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'join' is not defined
 
 I think I've seen this used elsewhere, but googling only seems to show
 results about the string method join, not whatever this is.
 
 To be clear, I understand how to use .join(list), but have not found
 any information about this other, seemingly global, join function
 which takes multiple arguments. It's been bugging me.

os.path.join

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


Re: Global join function?

2012-03-14 Thread Chris Rebert
On Wed, Mar 14, 2012 at 11:41 AM, Darrel Grant darrel...@gmail.com wrote:
 In the virtualenv example bootstrap code, a global join function is used.

 http://pypi.python.org/pypi/virtualenv

    subprocess.call([join(home_dir, 'bin', 'easy_install'),
                     'BlogApplication'])


 In interpeter, I tried this:

 [join([], 'bin', 'easy_install')]
 Traceback (most recent call last):
  File stdin, line 1, in module
 NameError: name 'join' is not defined

 I think I've seen this used elsewhere, but googling only seems to show
 results about the string method join, not whatever this is.

Those example snippets are broken. They're presumably missing the line:
from os.path import join
Docs for the function in question:
http://docs.python.org/library/os.path.html#os.path.join

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Global join function?

2012-03-14 Thread Peter Otten
Darrel Grant wrote:

 In the virtualenv example bootstrap code, a global join function is used.
 
 http://pypi.python.org/pypi/virtualenv

At this point there is probably an import that you have overlooked:

from os.path import join

 subprocess.call([join(home_dir, 'bin', 'easy_install'),
  'BlogApplication'])
 
 
 In interpeter, I tried this:
 
 [join([], 'bin', 'easy_install')]
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'join' is not defined
 
 I think I've seen this used elsewhere, but googling only seems to show
 results about the string method join, not whatever this is.
 
 To be clear, I understand how to use .join(list), but have not found
 any information about this other, seemingly global, join function
 which takes multiple arguments. It's been bugging me.


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