[01:46:22] ** ErikRose has left IRC () [05:01:58] [connected at Fri Sep 15 05:01:58 2006] [05:01:58] <> *** Looking up your hostname... [05:01:58] <> *** Checking ident [05:01:58] <> *** No identd (auth) response [05:01:58] <> *** Found your hostname [05:01:58] <> *** Your host is sterling.freenode.net[freebsd.widexs.nl/6667], running version hyperion-1.0.2 [05:01:59] [I have joined #peak] [09:29:48] ** ErikRose has joined us [10:20:09] ** ErikRose has left IRC () [10:35:37] ** apoirier has joined us [11:17:18] ** ErikRose has joined us [12:07:57] ** pje has joined us [12:34:17] ** WebMaven has joined us [12:34:28] Hello. [12:34:51] I am having a curious problem with eggs. [12:36:03] It seems as though, even though the directory with the eggs in in the pythonpath, the eggs are not discovered unless I explicitly re-add the directory to the pythonpath. [12:38:09] Here is an example session: http://paste.plone.org/10673 [12:39:10] Any ideas as to what's going on? [12:42:05] Hello? [12:42:12] pje: AYT? [12:42:21] yes? [12:42:55] Any idea as to what's causing my priblem with eggs? [12:43:26] * pje reads the paste [12:44:21] in the first part, how is that directory getting on sys.path in the first place? [12:45:23] The host does some kind of diddling so that users get their own local directory for packages. [12:45:45] Let me see if I can find the description he gave me. [12:46:07] Here we go: [12:46:28] " [snip] $HOME/lib/python2.4 is automatically added to your path whenever python starts (it's being done in sitecustomize.py, which is run by python when it starts)." [12:48:29] Unfortunately, you're not going to be able to fix this without your host's help, then, unless you either set PYTHONPATH or use a virtual python. [12:48:44] Presumably, the host is just slapping that directory in there rather than using site.addsitedir() [12:48:49] I can get the hosts help. [12:49:30] it's Remi at webfaction.com (formerly python-hosting.com) [12:49:40] Well, change the siteconfig.py to use "import site; site.addsitedir('...')" [12:50:01] OK. I'll pass that along. Thanks! [12:50:03] Then, .pth files will be usable there, which is needed for eggs to install properly [12:50:16] it also enables PIL, Numeric, etc. that also use .pth-based installation [12:50:34] (enables them to be installed in that directory; I see you've already got PIL in the system site-packages) [12:50:46] He must be doing it that way elsewhere. [12:50:52] yeah. [12:51:00] well, site-packages is automatically processed with site.addsitedir [12:51:15] "import site" does that part. [12:51:16] Ah, I see. [12:51:49] so making your $HOME/lib/python2.4 a "site" dir puts it on equal footing with the systemwide site-packages. [12:51:57] Oh, wait... one problem with that approach. [12:52:20] site.addsitedir() inserts things found in that dir at the *end* of sys.path [12:52:37] Eggs hack around this, but it won't work for other packages. Ugh. [12:52:54] Ah, so it wouldn't override existing packages? [12:52:56] Maybe it would be better to just set the PYTHONPATH in the profile directory [12:53:00] right, it would not. [12:53:05] You have to use PYTHONPATH for that. [12:53:08] I can live with that. [12:53:19] So the simplest thing is probably just to use PYTHONPATH. [12:53:30] Hmm. [12:53:43] Here is the manifestation of the problem: [12:54:09] I start Zope3 after exporting the directory to PYTHONPATH. Works fine. [12:54:10] As long as you either use PYTHONPATH or addsitedir for that directory, then eggs will override non-eggs, so the eggs shouldn't be a problem with respect to overrding. [12:54:37] it's non-eggs that might be a problem with the addsitedir approach [12:55:52] At soem point, the zdaemon spawns a new python process that does not have access to the original context, and my Zope3 app stops working until I log in, export, go into zopectl and stop and start the process. [12:56:43] I could, I suppose, hack zdaemon or runzope, but I'd rather not. [12:57:12] okay. So, here's what you can do... [12:57:34] oh wait, that won't work. [12:57:59] Hm... okay, second plan... the script having the problem, what directory is it in? [12:58:53] Well, I'm not 100% sure. [12:58:58] Here is what I do: [12:59:23] cd ~/webapps/rogue1/bin/ [12:59:29] ./zopectl [12:59:36] If you can find that directory; you can add a siteconfig.py to it that does the addsitedir [12:59:40] > start [13:00:21] but zopectl then uses zdaemon to run the runzope script [13:00:43] Are you familiar with running Zope? [13:00:56] I mean, recent versions. [13:02:22] no [13:02:29] I'm about to be, soon though. :) [13:03:12] Anyway, if you put a sitecustomize.py in the directory where the problematic script is [13:03:20] (not where it's *run from* - where the *file* is) [13:03:21] Here is the output of the 'show' command in zopectl: [13:03:24] http://paste.plone.org/10674 [13:03:54] okay, so you need a siteconfig.py in /home2/webmaven2/webapps/rogue1/bin [13:04:06] Are you sure? [13:04:14] that's where the runzope is. [13:04:22] And that's the process that's having a problem, right? [13:04:48] note line 13 of the paste [13:04:56] Well, it's either that, or maybe zdrun. [13:05:11] okay, then try both bin dirs. :) [13:05:33] OK, I'll try them one at a time. [13:05:40] but I assume that it's runzope that's giving you trouble, since zdrun doesn't need any local libs, does it? [13:05:52] Dunno. [13:06:08] checking. [13:09:18] It doesn't look like it *uses* local libs, no. But it is responsible for spawning new Zope processes. [13:10:45] Ok, it *looks* like it doesn't do any path manipulations of it's own. [13:11:03] So, I'll try with just runzope to start. [13:11:21] what goes in the sitecustomize.py script? [13:13:13] import site; site.addsitedir('.../lib/python2.4') [13:13:28] or you could use os.path.expanduser if you don't want to hardcode the home dir in that string [13:13:46] import os, site; site.addsitedir(os.path.expanduser('~/lib/python2.4')) [13:14:03] Ah, that is more elegant. [13:14:20] One moment, while I give it a try. [13:17:59] Hmm. Doesn't seem to work in /home2/webmaven2/webapps/rogue1/bin [13:19:09] is there anything else I need to do beside place it in the same dir as the script? [13:19:33] Note that these are #! scripts. [13:22:43] http://paste.plone.org/10675 [13:24:16] pje? [13:24:32] * pje looks at the paste [13:25:23] change your siteconfig.py to print something [13:25:40] OK. [13:25:58] then you can see if it's running. [13:27:32] No change. [13:28:23] Does in make a difference that both zopectl and runzope are #! scripts? [13:29:18] it shouldn't [13:29:28] I assume they're #!...python, right? [13:29:47] ** ErikRose has left IRC () [13:30:11] #!/usr/local/bin/python2.4 [13:32:10] here is my sitecustomize.py file: [13:32:13] import os, site [13:32:13] site.addsitedir(os.path.expanduser('~/lib/python2.4')) [13:32:13] print "Something" [13:33:32] and does Something get printed? [13:34:18] Not that I can see. Not when running zopectl, and not when starting Zope. [13:35:19] Did you ever try setting PYTHONPATH in your .profile or .bashrc or whatever? [13:36:13] * WebMaven blinks [13:36:16] No. [13:37:29] I assumed that would be equivalent to whatever the host was doing. [13:37:59] nope, it would be equivalent to setting PYTHONPATH [13:38:01] :) [13:38:31] I'm not sure if it'll help, if the problem is that the zdaemon stuff clears environment vars or something. [13:38:37] But it's worth a try [13:38:54] My home dir doesn't have either of those. [13:39:09] how about a .bash_profile? [13:39:17] or some kind of .csh thingy? [13:39:21] Oh, yes it does. Duh. [13:39:33] make sure to "export" it [13:39:42] * WebMaven forgot to do 'ls -al' [13:39:45] e.g. "export PYTHONPATH=..." [13:40:08] I have the following: [13:40:26] (that seem relevant) [13:40:33] .bash_profile [13:40:39] .bashrc [13:40:51] .zshrc [13:41:39] I'd go with .bash_profile then [13:42:39] Ok, there is already a PATH in it, how do I separate multiple paths? [13:42:52] PATH=$PATH:$HOME/bin [13:42:54] PATH doesn't matter, we're talking PYTHONPATH [13:43:05] Oh! right. [13:43:06] put a line with: [13:43:07] Ok. [13:43:13] export PYTHONPATH=$HOME/lib/python2.4 [13:45:01] do I need to log out and back in for it to take effect? [13:47:30] Apparently so. [13:48:04] That seems to have done it! [13:48:49] terrific [13:48:53] Now I'll just have to wait and see if the spawned processes work as well. [13:49:18] Sincve I do have the ear of the host, is there a way for him to fix this globally? [13:49:45] Perhaps in the systemwide /etc/.profile [13:50:07] Hmm. [13:50:20] No, I don't think that would be appropriate... [13:50:24] Here is why: [13:50:56] There are both /lib/python2.4 and /lib/python2.3 dirs. [13:51:04] Ah. [13:51:36] While I don't care about Python 2.3, I don't think it would be right to add that globally to the profile. [13:52:05] it needs to happen specifically for the python that is being run. [13:52:58] So, right now, he does it by doing this: " $HOME/lib/python2.4 is automatically added to your path whenever python starts (it's being done in sitecustomize.py, which is run by python when it starts)." [13:53:42] Right; doing it with site.addsitedir() in *addition* to what he's doing now would enable eggs to live there. [13:55:03] OK. Any bad side effects? [13:58:21] And how do you think he's currently adding the dir to the path that is *not* working for eggs? [14:00:35] no side effects [14:00:45] he's probably just inserting it into sys.path [14:04:55] OK. I've added this info to the trouble ticket. Thanks. [14:14:18] ** apoirier has left IRC ("KVIrc 3.2.0 'Realia'") [17:46:09] ** pje has left IRC (Read error: 104 (Connection reset by peer)) [17:54:58] ** pje has joined us [18:38:15] ** bitmvnch has joined us [18:39:34] ** coderanger has left IRC () [19:01:05] ** coderanger has joined us [19:05:18] ** bitmvnch has left IRC () [19:44:45] ** bitmvnch has joined us [20:44:50] ** pje has left IRC ("Client exiting") [20:54:08] ** ErikRose has joined us [21:13:02] ** ErikRose has left IRC (Connection timed out) [23:17:58] ** ErikRose has joined us