 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Wed Dec 27, 2006 3:28 am Post subject: Python and AS3 |
 |
|
|
|
I've been trying to modify a python module, and generally I have to actually run it to see what to change next. I figure the best way to check everything is to unload and reload the module. I can load a python module with ?insmod, but when I try to ?rmmod it, it fails. But it's not just this one, it's all python modules I've tried. I can't unload pymod and do everything over again, either. Is this a known problem in AS3? And also, is there a way to just reload it without unloading it, so it can re-read the source? That would probably be sufficient.
I'm having problems with cPickle as well. It just says something along the lines of "can't import". I had an error message similar(not exactly the same) before, and I tried re-installing python. Which was a mistake, yum used the other version only, and I ended up breaking yum, so I ended up reformatting. I'm going to go through the old AS3 logs(I hope I have them) to find out what the other error message was to see if they're similar, but in the mean time, do you guys know of any common problems with cPickle? I think I've seen it before in the forums, and I'll go search in a second, but since I was already asking one Python question I thought I'd ask another.
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Wed Dec 27, 2006 10:16 am Post subject: |
 |
|
|
|
cPickle is for persistant data, if you're not using it than don't worry about it. If you want to use it you'll need to update python, but, like you said, you can't. You could create an alternate implementation that doesn't use cPickle if you really want.
attach the simplest python module that won't unload and I'll look at it. _________________ SubSpace Discretion: A Third Generation SubSpace Client
|
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Wed Dec 27, 2006 8:58 pm Post subject: |
 |
|
|
|
I suppose I can live without persistent data in python. I can't really think of anything complex enough that would need persistent data that I'd want to code in Python. I don't know why, but if something is complex I'd rather do it in C. I probably have that backwards - if it's complex, it probably has a higher chance of crashing... which means I should probably use Python, considering I'm not the best coder.
Anyway, here's the watchgreen module(standard one that comes with AS3). There's nothing in the module about how to handle unloads, but I was under the impression that you didn't have to do that with Python modules. I haven't seen it done in any others, either. Maybe you can explain it, though. I take it you haven't had any issues unloading python modules? Maybe it's related to cPickle not loading, but that's just an off-handed guess. If it didn't load right, maybe it can't unload, either.
watchgreen.py - 1.57 KB
File downloaded or viewed 16 time(s)
|
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Wed Dec 27, 2006 10:05 pm Post subject: |
 |
|
|
|
I've got another question, and since it's in a Python module, I'll just continue in this thread. What is wrong with this line of code?
chat.SendArenaMessage(p.arena, "%s asked, \"%s\"" % p.name % params)
TypeError: not enough arguments for format string
The bottom line is the error AS3 gives me. That's a line from a command, so params should be available.
|
|
Back to top |
|
 |
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Wed Dec 27, 2006 11:44 pm Post subject: |
 |
|
|
|
What exactly are you typing to unload the module? You have to use the module name, which is different from the module specifier you gave to ?insmod. In other words, ?insmod <py>foo, but ?rmmod food. (Once it's loaded, asss already knows the type of module it is, so you don't have to tell it again.)
For formatting, the % operator takes a string and a tuple of arguments. Do "%s ... %s" % (a, b). You're doing it boost::format-style.
|
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Fri Dec 29, 2006 12:36 am Post subject: |
 |
|
|
|
Oh, so I just type ?rmmod watchgreen ?
I'll try it out in a bit.
I wish I understood what boost::format meant.
|
|
Back to top |
|
 |
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 32 page(s) served in previous 5 minutes.
|