Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder2.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'newbie': 0.03; 'python.': 0.04; '2.7': 0.04; 'arguments': 0.05; 'session.': 0.05; 'sure.': 0.05; 'subject:Python': 0.06; 'path,': 0.07; 'seemed': 0.07; 'semantic': 0.07; 'python': 0.08; 'line:': 0.09; 'reason.': 0.09; 'tuple': 0.09; 'message-----': 0.12; 'am,': 0.13; 'wrote:': 0.15; 'installed,': 0.16; 'parentheses': 0.16; 'problem).': 0.16; 'subject:Newbie': 0.16; 'subject:Programming': 0.16; 'tuple;': 0.16; 'unpacking.': 0.16; 'def': 0.16; 'programming': 0.18; 'work,': 0.20; 'to:2**1': 0.21; 'input': 0.21; 'variable': 0.21; 'maybe': 0.22; 'header:In-Reply-To:1': 0.22; 'subject:help': 0.22; 'away.': 0.23; 'compiled': 0.23; 'code': 0.24; 'bruce': 0.25; 'modules': 0.25; 'function': 0.26; 'url:mailman': 0.27; 'changing': 0.28; 'guess': 0.28; 'script': 0.29; 'idle': 0.29; 'problem': 0.29; 'fix': 0.29; 'environment': 0.29; 'subject:': 0.30; 'definition': 0.30; 'match': 0.30; 'module': 0.30; 'modules,': 0.30; 'none,': 0.30; 'sun,': 0.30; 'syntax,': 0.30; 'url:dev': 0.30; 'error': 0.31; 'url:listinfo': 0.32; 'print': 0.32; 'chris': 0.32; 'list': 0.32; 'rather': 0.33; 'to:addr :python-list': 0.34; 'sent:': 0.34; 'there': 0.34; 'subject:Web': 0.34; 'statement,': 0.35; 'installed': 0.35; 'uses': 0.35; 'from:': 0.36; 'page': 0.36; 'url:python': 0.37; 'issue': 0.37; 'open': 0.37; 'but': 0.37; 'could': 0.37; 'using': 0.37; 'url:org': 0.38; 'subject:: ': 0.38; 'hello,': 0.38; 'think': 0.38; 'run': 0.39; 'web,': 0.39; 'should': 0.39; 'received:rr.com': 0.39; 'rest': 0.39; 'url:docs': 0.39; 'help': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'did': 0.40; 'where': 0.40; 'or,': 0.40; 'other.': 0.62; 'link': 0.63; 'july': 0.64; 'needing': 0.64; 'interest': 0.65; 'touch': 0.66; 'print()': 0.84; 'received:206.221': 0.84; 'doesn\x92t': 0.93 From: "Bruce Whealton" To: "Chris Angelico" , References: <1356CE18703044AEA015CB1C4BA9A3C7@BrucePC> In-Reply-To: Subject: Re: Newbie help - Programming the Semantic Web with Python Date: Sat, 16 Jul 2011 21:35:22 -0400 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3508.1109 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vms.futurewavedesigns.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - whealton.info X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310866521 news.xs4all.nl 23956 [2001:888:2000:d::a6]:44518 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9666 Hello, So, regarding the path that python uses to find modules, I read the link that you sent. Suppose, I open IDLE and start an interactive session. That would mean the input script location is wherever python is installed, correct? I did add an environment variable PYTHONPATH which did not even exist when I first installed Python. I figured I would want to have a directory where I could store modules that might interest me. I might want to expand that into a package style path later. Now, if I was going to create an application to run on the web, I guess those included modules would have to get compiled with the rest of the code for it to work, right? Bruce -----Original Message----- From: Chris Angelico Sent: Saturday, July 09, 2011 10:10 PM To: python-list@python.org Subject: Re: Newbie help - Programming the Semantic Web with Python On Sun, Jul 10, 2011 at 11:32 AM, Bruce Whealton wrote: problem with is this line: > def add(self, (sub, pred, obj)): > I think the problem is with the parentheses before the sub. I removed > those and that seemed to fix that error or make it go away. I don’t > remember how I figured that out, It should be on the Errata page for > sure. > Then it has a problem with this line: > print list(g.triples((None, None, None))) > If I was using python 3, it would require () around the thing that is > going to be printed, right? Maybe python 2.7 doesn’t like this line for > the same reason. > The issue there is with tuple unpacking. To match the older syntax, don't touch the call, but change the definition thus: def add(self, args): (sub, pred, obj)=args Or, of course, simply list the arguments directly, rather than in a tuple; but that requires changing every call (if it's a small program that may not be a problem). You're right about needing parentheses around the print() call; in Python 2 it's a statement, but in Python 3, print is a function like any other. Regarding the module search path, this may help: http://docs.python.org/dev/tutorial/modules.html#the-module-search-path Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list