<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Gareth Jones - Latest Comments in Replacing Python on a Battlefield 2 server</title><link>http://garethj.disqus.com/</link><description></description><language>en</language><lastBuildDate>Wed, 02 Jul 2008 03:49:12 -0000</lastBuildDate><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-796231</link><description>So sounds like you've done everything correctly. I assume you've kept the relative locations in the sys.path such as 'python', 'mods/bd2/python' and 'admin' as these are battlefield specific libraries it will try to load? Failing that, try the 32 bit version - maybe BF2 always runs a 32bit Python regardless of which version the game is running.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Wed, 02 Jul 2008 03:49:12 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-794043</link><description>I   1. Replace the Battlefield 2 Python library (e.g. ‘bf2/bin/ia-32/libdice_py.so’) with the version of your choice. I just linked to my locally installed version ‘/usr/lib/libpython2.5.so’.&lt;br&gt;   2. Replace the Python library path at runtime to use the new libraries, e.g. edit ‘bf2/python/bf2/__init__.py’ and putting the equivalent of ’sys.path = ['/usr/lib/python2.5/', '/usr/lib/python2.5/lib-dynload/', 'python', 'mods/bf2/python', 'admin']‘ after the ‘import sys’ line.&lt;br&gt;&lt;br&gt;Is what I did, but I did substitute my version for 2.5.  I used locate to find the directories for python.  I run the 64 bit version of bf2.exe so I figured 64bit libs would be a proper replacement.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal</dc:creator><pubDate>Tue, 01 Jul 2008 19:25:42 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-777588</link><description>What exactly have you changed? Have you replaced (or linked) the libdice_py.so in the Battlefield directory with your own and editing the __init__.py? If that's all done, there might be an issue with replacing a 32-bit Python with a 64-bit one (which is what your directory names suggest) so that could be the cause.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Mon, 30 Jun 2008 04:16:02 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-774530</link><description>I tried your method and when the server starts it crashes with "Import Error:" and flashes back to shell.  I am using python2.4 and have changed the usr/lib/python2.5 to usr/lib64/python2.4 any clues?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal</dc:creator><pubDate>Sun, 29 Jun 2008 13:55:32 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-769701</link><description>Yes.  Thank you.&lt;br&gt;&lt;br&gt;Originally I wanted to use post methods, but I now think a simple get is more efficent for my level of coding.  It also means that I can use the standard python lib that comes with bf2.  &lt;br&gt;&lt;br&gt;I appreciate the help.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal361</dc:creator><pubDate>Sat, 28 Jun 2008 11:17:33 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-753772</link><description>Something like this should do the job:&lt;br&gt;&lt;br&gt;import urllib&lt;br&gt;webPageHandle = urllib.urlopen('http://blog.garethj.com/')&lt;br&gt;webPageContents = webpage.read()&lt;br&gt;&lt;br&gt;Then obviously you'll have to parse webPageContents for the information you need and use the BF2 API to send that into the game. This page looks like a good tutorial if you need more help: &lt;a href="http://www.voidspace.org.uk/python/articles/urllib2.shtml" rel="nofollow"&gt;http://www.voidspace.org.uk/python/articles/url...&lt;/a&gt;&lt;br&gt;&lt;br&gt;Hope that's useful :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Thu, 26 Jun 2008 10:49:50 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-752993</link><description>Yep.  Requests for webpages in the existing python return garbage results so far.  I'd like to be able to have a python script call a webpage, parse the results, then display the results in game.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal</dc:creator><pubDate>Thu, 26 Jun 2008 09:17:17 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-752856</link><description>I have the alternative version of Python running correctly doing what I need but I'm not sure what you mean by URL calls - is this the kind of thing you're after: &lt;a href="http://www.python.org/doc/lib/module-httplib.html?" rel="nofollow"&gt;http://www.python.org/doc/lib/module-httplib.html?&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Thu, 26 Jun 2008 08:57:30 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-751165</link><description>Well that is great news.  Have you been able to get url calls working properly?  I don't know much about python, but recoding our in game management system has been a fun experience.  Right now, I'd like to use a url call to allow admins to register their keyhash via a php page and get a success or fail notification in game.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal</dc:creator><pubDate>Wed, 25 Jun 2008 23:20:57 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-730524</link><description>Hey Cal. Yes this works fine for me - let me know if I can help at all.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Mon, 23 Jun 2008 11:09:30 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-695957</link><description>So is this running in a stable manner for you?  I have some url calls I would like to make in the game and this would be a welcome help.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cal</dc:creator><pubDate>Tue, 17 Jun 2008 20:46:09 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-430919</link><description>It's a hard life I know... :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">garethj</dc:creator><pubDate>Thu, 08 May 2008 03:52:37 -0000</pubDate></item><item><title>Re: Replacing Python on a Battlefield 2 server</title><link>http://blog.garethj.com/2008/05/07/replacing-python-on-a-battlefield-2-server/#comment-427556</link><description>Hmm. I'm not really into games, but I'd still fancy a job where they crop as "work"!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Pete</dc:creator><pubDate>Wed, 07 May 2008 13:09:16 -0000</pubDate></item></channel></rss>