Re: PEP: possibility of inline using of a symbol instead of import

2011-01-06 Thread Mike Kent
On Jan 6, 11:02 am, Duncan Booth duncan.bo...@invalid.invalid wrote: Your complaint seems to be that:    r1 = myFunc1(...) is unclear when you don't know where myfunc1 originates, so why don't you write:    r1 = MyModule1.myFunc1(...) -- Duncan Boothhttp://kupuguy.blogspot.com My

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Mike Kent
You might want to check out the Python 2.7 'pipes' standard library module: http://docs.python.org/library/pipes.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordering tests in a testsuite

2010-10-08 Thread Mike Kent
But sometimes you just wanna do it the way you wanna do it. If you name your tests like 'test_01_yadda' and test_02_whatever', then they will be run in the order you want, as given by the numbers. -- http://mail.python.org/mailman/listinfo/python-list

Re: python database

2010-09-03 Thread Mike Kent
On Sep 3, 2:36 am, shai garcia melodybel...@gmail.com wrote: can you pls help me to make a database program in python? It's better if you do your homework yourself. You learn more that way. Now, if you have a specific question about some detail of your assignment, and can show us that you've

Re: Does MySQLdb rollback on control-C? Maybe not.

2010-09-03 Thread Mike Kent
On Sep 3, 12:22 am, John Nagle na...@animats.com wrote:     I would expect MySQLdb to rollback on a control-C, but it doesn't seem to have done so.   Something is broken. I wouldn't expect it to, I'd expect to roll back on an exception, or commit if not. Perhaps this will help you. I use it

Re: New to python - parse data into Google Charts

2010-09-03 Thread Mike Kent
On Sep 3, 1:52 pm, alistair alistair.cal...@gmail.com wrote: I'm new to python and my programming years are a ways behind me, so I was looking for some help in parsing a file into a chart using the Google Charts API. Try this: http://pygooglechart.slowchop.com/ --

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Mike Kent
On Aug 8, 8:43 pm, rantingrick rantingr...@gmail.com wrote: Hello folks, You all know i been forced to use Ruby and i am not happy about that. ***Blablabla cut long rant*** Xah, this is really you, isn't it. Come on, confess. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie problem with str.replace

2010-08-04 Thread Mike Kent
On Aug 4, 9:10 am, BobAalsma bob.aal...@aalsmacons.nl wrote: I'm working on a set of scripts and I can't get a replace to work in the script - please help.                         bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN) I'm not sure what you are intending to do here, but

Re: Reactive programming in Python ?

2010-04-16 Thread Mike Kent
On Apr 16, 11:18 am, pca pcarb...@yooper.be wrote: Dear all, Could “reactive programming” still increase the productivity and joy of Python programming?  I’d like to hear your thoughts on the idea that object-oriented “programming by formula”, as in a spreadsheet, would simplify our work,

SEC apparently about to mandate Python for a particular financial use

2010-04-16 Thread Mike Kent
http://jrvarma.wordpress.com/2010/04/16/the-sec-and-the-python/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Relocatable python install

2010-04-14 Thread Mike Kent
On Apr 14, 4:50 pm, Michel michel.metz...@gmail.com wrote: Hi, I would like to create a binary package of python that we will ship with our product. I need to be able to install the package anywhere in the file system. The interpreter seems to be ok with that, but a few other tools that

[issue8329] select.select() can return lists with identical id()'s

2010-04-06 Thread Mike Kent
New submission from Mike Kent mike.k...@sage.com: If select.select() returns two or more empty lists, these empty lists will all refer to the same list; that is, they will have identical id()'s. If you then have reason to alter one of the returned empty lists, you are altering all

[issue8329] select.select() can return lists with identical id()'s

2010-04-06 Thread Mike Kent
Changes by Mike Kent mike.k...@sage.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8329 ___ ___ Python-bugs-list mailing

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Mike Kent
On Mar 30, 11:40 am, gentlestone tibor.b...@hotmail.com wrote: Hi, how can I write the popular C/JAVA syntax in Python? Java example:     return (a==b) ? 'Yes' : 'No' My first idea is:     return ('No','Yes')[bool(a==b)] Is there a more elegant/common python expression for this? return

Re: A scopeguard for Python

2010-03-05 Thread Mike Kent
On Mar 4, 8:04 pm, Robert Kern robert.k...@gmail.com wrote: No, the try: finally: is not implicit. See the source for contextlib.GeneratorContextManager. When __exit__() gets an exception from the with: block, it will push it into the generator using its .throw() method. This raises the

Re: A scopeguard for Python

2010-03-04 Thread Mike Kent
On Mar 3, 10:56 am, Alf P. Steinbach al...@start.no wrote: * Mike Kent: What's the compelling use case for this vs. a simple try/finally? if you thought about it you would mean a simple try/else. finally is always executed. which is incorrect for cleanup by the way, that's one advantage

Re: A scopeguard for Python

2010-03-04 Thread Mike Kent
On Mar 4, 12:30 pm, Robert Kern robert.k...@gmail.com wrote: He's ignorant of the use cases of the with: statement, true. humor Ouch! Ignorant of the use cases of the with statement, am I? Odd, I use it all the time. /humor Given only your example of the with: statement, it is hard to fault

Re: A scopeguard for Python

2010-03-04 Thread Mike Kent
On Mar 3, 12:00 pm, Robert Kern robert.k...@gmail.com wrote: On 2010-03-03 09:39 AM, Mike Kent wrote: What's the compelling use case for this vs. a simple try/finally?     original_dir = os.getcwd()     try:         os.chdir(somewhere)         # Do other stuff     finally

Re: A scopeguard for Python

2010-03-03 Thread Mike Kent
What's the compelling use case for this vs. a simple try/finally? original_dir = os.getcwd() try: os.chdir(somewhere) # Do other stuff finally: os.chdir(original_dir) # Do other cleanup -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a maximum size to a Python program?

2009-04-27 Thread Mike Kent
On Apr 27, 1:49 am, John Machin sjmac...@lexicon.net wrote: I am having a look at eval and exec WRONG WAY GO BACK +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Can I use setup.py to ship and install only .pyc files?

2009-04-16 Thread Mike Kent
I'd like to ship only the .pyc files for a module. I was hoping the standard distutils setup.py could handle this, but so far, I've not figured out how. After a bit of work, I discovered that if I create a MANIFEST.in file, and put 'include mymodule/*.pyc' and 'exclude mymodule/*.py' in it, then

Re: FTP libs for Python?

2009-02-20 Thread Mike Kent
I use Fabric (http://www.nongnu.org/fab/) as my Python-based deployment tool, but it uses ssh/scp, not sftp. -- http://mail.python.org/mailman/listinfo/python-list

Re: function scope

2009-02-02 Thread Mike Kent
On Feb 2, 6:40 pm, Baris Demir demirba...@gmail.com wrote: def simpleCut(d=dict()):        temp=d        for i in temp.keys():            if    (temp[i] == ...) :               temp[i]=new_value return temp You have been bitten by the shared default parameter noobie trap:

Problem building Python 2.5.2 curses module on HP/UX 11.11

2009-01-06 Thread Mike Kent
I'm having a problem building the Python 2.5.2 curses module on HP/UX 11.11 using gcc 3.3.6, and was hoping someone had a solution. Compiling Modules/_cursesmodule.c is giving several warnings, but no errors. The relevant compile/link output is below. The key output line is: *** WARNING:

Re: Possible read()/readline() bug?

2008-10-23 Thread Mike Kent
To followup on this: Terry: Yes, I did in fact miss the 'buffer' parameter to open. Setting the buffer parameter to 0 did in fact fix the test code that I gave above, but oddly, did not fix my actual production code; it continues to get the data as first read, rather than what is currently on the

Possible read()/readline() bug?

2008-10-22 Thread Mike Kent
Before I file a bug report against Python 2.5.2, I want to run this by the newsgroup to make sure I'm not being stupid. I have a text file of fixed-length records I want to read in random order. That file is being changed in real-time by another process, and my process want to see the changes to

Re: How to delete a last character from a string

2008-08-29 Thread Mike Kent
On Aug 29, 2:28 pm, [EMAIL PROTECTED] wrote: Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their

Re: Python multimap

2008-08-27 Thread Mike Kent
On Aug 27, 9:35 am, brad [EMAIL PROTECTED] wrote: Recently had a need to us a multimap container in C++. I now need to write equivalent Python code. How does Python handle this? k['1'] = 'Tom' k['1'] = 'Bob' k['1'] = 'Joe' ... Same key, but different values. No overwrites either They

Re: Convert string to char array

2008-07-01 Thread Mike Kent
On Jul 1, 2:49 pm, Brandon [EMAIL PROTECTED] wrote: How do I convert a string to a char array?  I am doing this so I can edit the string received from an sql query so I can remove unnecessary characters. Answering your specific question: Python 2.5.1 (r251:54863, Mar 31 2008, 11:09:52) [GCC

Re: Notify of change to list

2008-06-16 Thread Mike Kent
I recently wanted to do the same kind of thing. See this tread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/f27c3b7950424e1c for details on how to do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing list, what special methods do this?

2008-06-14 Thread Mike Kent
On Jun 13, 8:43 pm, Matimus [EMAIL PROTECTED] wrote: ...chop... So, it looks like as long as you want to subclass list, you are stuck implementing both __*slice__ and __*item__ methods. Matt Thanks. That was clear and concise, just what I needed. --

Subclassing list, what special methods do this?

2008-06-13 Thread Mike Kent
For Python 2.5 and new-style classes, what special method is called for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a list, and seq is some sequence)? I'm trying to subclass list, and I'm having trouble determining what special methods I have to override in my class for the

Re: Constructor re-initialization issue

2008-06-03 Thread Mike Kent
On Jun 3, 6:11 pm, [EMAIL PROTECTED] wrote: Hello all, I have come across this issue in Python and I cannot quite understand what is going on. class Param(): def __init__(self, data={}, condition=False): if condition: data['class']=Advanced print data In

Re: list index out of range

2008-05-13 Thread Mike Kent
On May 13, 2:39 pm, Georgy Panterov [EMAIL PROTECTED] wrote: def deal_hand(deck): HAND=[] for _ in range(2): i=random.randint(0,len(deck)) #produces a random card from the deck ^ Here i can be from 0 thru (the number of cards in the deck).

Re: creating a list from a inconsistent text file

2008-05-02 Thread Mike Kent
On May 2, 9:47 am, Jetus [EMAIL PROTECTED] wrote: Hello Marc; Thanks for the input! I am worried about the comma in the data items, how do I tell Python to look for the data first, then use the comma separator? Marc has already given you the correct answer. You really should read up on

Re: Pythonically extract data from a list of tuples (getopt)

2008-04-23 Thread Mike Kent
You could use http://docs.python.org/lib/module-optparse.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Finally had to plonk google gorups.

2008-04-16 Thread Mike Kent
On Apr 16, 10:26 am, Mike Driscoll [EMAIL PROTECTED] wrote: Yeah, I noticed that Google Groups has really sucked this week. I'm using the Google Groups Killfile for Greasemonkey now and it helps a lot. I like Google, but my loyalty only goes to far. This is a complete lack of customer

Re: Talking to a usb device (serial terminal)

2008-03-03 Thread Mike Kent
So my question is this - what is the easiest way to interface to this serial device? http://pyserial.sourceforge.net/ or perhaps http://pyusb.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list

What should I use under *nix instead of freeze?

2008-02-01 Thread Mike Kent
In a comment Guido made on a recent bug report for the 'freeze' utility, he stated: I think nobody really cares about freeze any more -- it isn't maintained. That being the case, what is the preferred/best replacement for freeze on a *nix platform? I'm looking for something that, like freeze,

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Mike Kent
On Jan 26, 7:23 am, Dox33 [EMAIL PROTECTED] wrote: I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. ===CUT=== *** Thirst, redirect stderr to file, STRANGE behaviour.. From the command prompt I run: python script.py 2 stderr_catch.txt This

Re: Can someone explain this unexpected raw_input behavior?

2008-01-24 Thread Mike Kent
If it weren't for the documentation... If the prompt argument is present, it is written to *standard output* without a trailing newline. -- mvh Björn I have reported this issue to the python-dev mailing list, and Guido agrees that this is a bug in Python. It turns out that the key is

Re: Reporting Python bugs (was: Can someone explain this unexpectedraw_input behavior?)

2008-01-24 Thread Mike Kent
On Jan 24, 5:13 pm, Terry Reedy [EMAIL PROTECTED] wrote: Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Mike Kent [EMAIL PROTECTED] writes: | | A bug issue has been opened in the Python Trac system for this. | | Wouldn't it be better to report it in the official

Re: How avoid both a newline and a space between 2 print commands?

2008-01-23 Thread Mike Kent
On Jan 23, 9:03 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: print foo print bar has a newline in between foo and bar print foo, print bar has a space in between foo and bar How prevent ANYTHING from going in between foo and bar ?? (Without defining a string variable.) Chris

Can someone explain this unexpected raw_input behavior?

2008-01-23 Thread Mike Kent
It's often useful for debugging to print something to stderr, and to route the error output to a file using '2filename' on the command line. However, when I try that with a python script, all prompt output from raw_input goes to stderr. Consider the following test program: === Start test.py ===

Re: Can someone explain this unexpected raw_input behavior?

2008-01-23 Thread Mike Kent
Gabriel, thank you for clarifying the source of this behavior. Still, I'm surprised it would be hard-coded into Python. Consider an interactive program, that asks the user several questions, and displays paragraphs of information based on those questions. The paragraphs are output using print,

Need some help with 'with'

2007-11-27 Thread Mike Kent
I recently found myself needing to do this a lot: lock a record in a file read the record into a buffer alter the buffer write the buffer back to the record unlock the record I'd love to be able to create a context for this to use with the 'with' statement, something like: from __future__

Re: python question!!

2007-11-22 Thread Mike Kent
On Nov 22, 8:23 pm, bruce [EMAIL PROTECTED] wrote: is there a function/feature/etc.. that i can run on foo.py that would walk through the entire list of files that make up foo.py, so i could see the list of *.py files that are required to run foo.py. There's this:

ACM SIGAPL / APL2007 Conference / Montreal / one week away

2007-10-15 Thread Mike Kent
Conference page // with links to program details // (updated Friday 10/12) http://www.sigapl.org/apl2007.html Co-located with OOPSLA 2007 http://www.oopsla.org/oopsla2007 On-line registration (through Wednesday 10/17)

APL2007 reminder: early (cheaper) registration ends Thursday 9/13

2007-09-08 Thread Mike Kent
On-line registration is through the OOPSLA registrar http://www.regmaster.com/conf/oopsla2007.html APL 2007 home page http://www.sigapl.org/apl2007.html -- http://mail.python.org/mailman/listinfo/python-list

What's on at APL 2007, Montreal, October 21, (Tutorials) 22, 23 (Program)

2007-08-31 Thread Mike Kent
( Details and abstracts coming to the APL 2007 web page http://www.sigapl.org/apl2007.html shortly. In the meantime ... ) Tutorials and workshops Introduction to APL (Ray Polivka) OO for APLers, APL for OOers (Dan Baronet) ... others in the works Presentations

(Re)announcing APL 2007

2007-08-05 Thread Mike Kent
APL 2007 conference on Array Programming co-located with OOPSLA 2007 Sponsor: ACM SIGAPL Where:Montreal When: October 21 (tutorials) October 22/23 (main conference program) Keynote Guy Steele speaker:

Re: Announcing: ACM SIGAPL apl 2007 -- Arrays and Objects

2007-05-31 Thread Mike Kent
The APL2007 URL was given incorrectly should be http://www.sigapl.org/apl2007.html -- http://mail.python.org/mailman/listinfo/python-list

Announcing: ACM SIGAPL apl 2007 -- Arrays and Objects

2007-05-27 Thread Mike Kent
, CANADA Conference hotel: Hyatt Regency Montreal Committee General Chair Guy Laroque [EMAIL PROTECTED] Program Chair Lynne C. Shaw[EMAIL PROTECTED] Treasurer Steven H. Rogers [EMAIL PROTECTED] Publicity Mike Kent[EMAIL

Re: Join strings - very simple Q.

2007-03-23 Thread Mike Kent
On Mar 23, 2:37 pm, Paulo da Silva [EMAIL PROTECTED] wrote: Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way: l=['a','b','c'] jl=string.join(l,',') New way? Thanks

Re: Pickle Problem

2007-03-15 Thread Mike Kent
On Mar 15, 11:13 am, tonyr1988 [EMAIL PROTECTED] wrote: if __name__=='__main__': x = DemoClass x.WriteToFile You meant to create a DemoClass instance object, but instead, you obtained a reference to the class object. You want 'x = DemoClass()' instead. You meant to call the

Re: doxygen

2007-03-04 Thread Mike Kent
On Mar 4, 1:15 pm, Jan Danielsson [EMAIL PROTECTED] wrote: When I run doxygen on my python files, it does document classes, but not standalone functions. Look in the doxygen config file for your python project, named 'Doxyfile', for the config setting 'EXTRACT_ALL', and read the comments

Re: conditional computation

2006-10-26 Thread Mike Kent
robert wrote: I want to use a computation cache scheme like o = CACHECOMPUTE complex-key-expr expensive-calc-expr frequently and elegantly without writing complex-key-expr or expensive-calc-expr twice. So its ugly: _=complex-key-expr; o=cache.get(_) or

Re: question about True values

2006-10-25 Thread Mike Kent
John Salerno wrote: I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? s = 'hello' s == True False if s: print 'hi' hi Thanks. Excellent question! This should help: s =

Re: Python newbie with a problem writing files

2006-09-03 Thread Mike Kent
feed_list = open(feed_listing.conf,r) What could it be about the above line that means Open this file for READ ONLY? -- http://mail.python.org/mailman/listinfo/python-list

Re: newb question: file searching

2006-08-08 Thread Mike Kent
[EMAIL PROTECTED] wrote: I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. What you want is os.walk().

Re: Process files in order

2006-07-27 Thread Mike Kent
How about using os.listdir to build a list of filenames, then sorting them by modification time (via os.stat)? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to automate user input at the command prompt?

2006-07-21 Thread Mike Kent
[EMAIL PROTECTED] wrote: You may want to look at pexpect: http://pexpect.sourceforge.net/ But I am not sure about its support on windows. To the best of my recent investigation, and an email exchange with the author of pexpect, it is NOT supported under Windows. --

Re: Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread Mike Kent
gmax2006 wrote: Hi, I am developing scripts that must run on both Linux and windows. My scripts contain lots of relative paths (such as log\\log.txt or ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any tips or techniques to have Python automatically converts \\ to / when

Re: Advice for Python Reporting Tool

2006-07-12 Thread Mike Kent
rwboley wrote: My question is: how can I make that graphing step easier? Ideally I'd like the chart to exist on it's own page, but I have no idea where to even begin to implement this. Any thoughts would be appreciated. I've seen several people recommend matplotlib for this kind of thing.

Re: 2 problems

2006-07-07 Thread Mike Kent
[EMAIL PROTECTED] wrote: Hello,Im using Python 2.4.2 and I'm starting a few very basic programs,but theres two problems I've not found the answers for. My first problem is I need code that will count the number of letters in a string and return that number to a variable. s = hello len(s) 5

Re: List Manipulation

2006-07-04 Thread Mike Kent
Roman wrote: I would appreciate it if somebody could tell me where I went wrong in the following snipet: When I run I get no result cnt = 0 p=[] reader = csv.reader(file(f:\webserver\inp.txt), dialect=excel, quotechar=', delimiter='\t') for line in reader:

Re: List Manipulation

2006-07-04 Thread Mike Kent
Roman wrote: Thanks for your help My intention is to create matrix based on parsed csv file. So, I would like to have a list of columns (which are also lists). I have made the following changes and it still doesn't work. cnt = 0 p=[[], [], [], [], [], [], [], [], [], [], []] reader =

Re: Easier way to save result of a function?

2006-07-04 Thread Mike Kent
James Mitchelhill wrote: Sorry for the clunky subject line - I have a feeling that not knowing the proper terms for this is part of my problem. I'm trying to write a class that analyses some data. I only want it to do as much work as necessary, so it saves method results to a dictionary,

Re: unittest behaving oddly

2006-06-20 Thread Mike Kent
David Vincent wrote: import unittest class IntegerArithmenticTestCase(unittest.TestCase): def testAdd(self): ## test method names begin 'test*' assertEquals((1 + 2), 3) assertEquals(0 + 1, 1) assertEquals is a member function, inherited from unittest.TestCase, so

Re: Is there a better way of accessing functions in a module?

2006-06-13 Thread Mike Kent
Yes, you can go that route. But since it appears that what you are doing is unit testing related, and you are interested in aranging for all of your unit test cases to be run automatically, I'd suggest using the unittest module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching and manipulating lists of tuples

2006-06-12 Thread Mike Kent
MTD wrote: Hello, I'm wondering if there's a quick way of resolving this problem. In a program, I have a list of tuples of form (str,int), where int is a count of how often str occurs ... So clearly that doesn't work... any ideas? Yes, use the proper tool for the job. Tuples are

Re: problem with google api / xml

2006-05-31 Thread Mike Kent
robin wrote: from SOAPpy import WSDL WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl' APIKEY = '' _server = WSDL.Proxy(WSDLFILE) Robin, note this part of the URI set in WSDLFILE: '/pathtomy/googleapi'. Get it? 'path to my google api'. You must set this part to the actual path where

Anyone compiling Python 2.3 on an SCO OpenServer 5 box?

2006-05-25 Thread Mike Kent
If anyone is successfully compiling Pyton 2.3 on an SCO OpenServer 5 box, I'd appreciate hearing from you on how you managed to do it. So far, I'm unable to get a python that doesn't coredump. -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone compiling Python 2.3 on an SCO OpenServer 5 box?

2006-05-25 Thread Mike Kent
I need to compile Python on OpenServer 5 because I need to 'freeze' our Python app, and running 'freeze' requires a working, compilable source installation of Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: List behaviour

2006-05-17 Thread Mike Kent
When you did: b = a[:] b was then a copy of a, rather than just a reference to the same a. But what does a contain? It contains two sublists -- that is, it contains references to two sublists. So b, which is now a copy of a, contains copies of the two references to the same two sublists. What

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Mike Kent
Python 2.4.2 (#1, Nov 29 2005, 14:04:55) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type help, copyright, credits or license for more information. import os d = /home/testuser/projects os.path.basename(d) 'projects' os.path.dirname(d) '/home/testuser' --