<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" 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><atom:link href="https://garethj.disqus.com/replacing_python_on_a_battlefield_2_server_39/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 15 Jun 2010 07:45:54 -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-56805112</link><description>&lt;p&gt;If I knew it was so easy to change the Python version, I would have done it before quitting playing the game. &lt;br&gt;Sandra Millhouse | &lt;a href="http://www.webfusion.co.uk/dedicatedservers/saver-servers.php" rel="nofollow noopener" target="_blank" title="http://www.webfusion.co.uk/dedicatedservers/saver-servers.php"&gt;cheap virtual server&lt;/a&gt;&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SandraMillhouse</dc:creator><pubDate>Tue, 15 Jun 2010 07:45:54 -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-796231</link><description>&lt;p&gt;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.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;I   1. Replace the Battlefield 2 Python library (e.g. ‘bf2/bin/ia-32/&lt;a href="http://libdice_py.so" rel="nofollow noopener" target="_blank" title="libdice_py.so"&gt;libdice_py.so&lt;/a&gt;’) with the version of your choice. I just linked to my locally installed version ‘/usr/lib/&lt;a href="http://libpython2.5.so" rel="nofollow noopener" target="_blank" title="libpython2.5.so"&gt;libpython2.5.so&lt;/a&gt;’.&lt;br&gt;   2. Replace the Python library path at runtime to use the new libraries, e.g. edit ‘bf2/python/bf2/&lt;a href="http://__init__.py" rel="nofollow noopener" target="_blank" title="__init__.py"&gt;__init__.py&lt;/a&gt;’ 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;/p&gt;&lt;p&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.&lt;/p&gt;</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>&lt;p&gt;What exactly have you changed? Have you replaced (or linked) the &lt;a href="http://libdice_py.so" rel="nofollow noopener" target="_blank" title="libdice_py.so"&gt;libdice_py.so&lt;/a&gt; in the Battlefield directory with your own and editing the &lt;a href="http://__init__.py?" rel="nofollow noopener" target="_blank" title="__init__.py?"&gt;__init__.py?&lt;/a&gt; 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.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;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?&lt;/p&gt;</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>&lt;p&gt;Yes.  Thank you.&lt;/p&gt;&lt;p&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;/p&gt;&lt;p&gt;I appreciate the help.&lt;/p&gt;</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>&lt;p&gt;Something like this should do the job:&lt;/p&gt;&lt;p&gt;import urllib&lt;br&gt;webPageHandle = urllib.urlopen('&lt;a href="http://blog.garethj.com/')" rel="nofollow noopener" target="_blank" title="http://blog.garethj.com/')"&gt;http://blog.garethj.com/')&lt;/a&gt;&lt;br&gt;webPageContents = &lt;a href="http://webpage.read" rel="nofollow noopener" target="_blank" title="webpage.read"&gt;webpage.read&lt;/a&gt;()&lt;/p&gt;&lt;p&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 noopener" target="_blank" title="http://www.voidspace.org.uk/python/articles/urllib2.shtml"&gt;http://www.voidspace.org.uk...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Hope that's useful :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;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.&lt;/p&gt;</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>&lt;p&gt;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 noopener" target="_blank" title="http://www.python.org/doc/lib/module-httplib.html?"&gt;http://www.python.org/doc/l...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;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.&lt;/p&gt;</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>&lt;p&gt;Hey Cal. Yes this works fine for me - let me know if I can help at all.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;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.&lt;/p&gt;</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>&lt;p&gt;It's a hard life I know... :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth Jones</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>&lt;p&gt;Hmm. I'm not really into games, but I'd still fancy a job where they crop as "work"!&lt;/p&gt;</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>