Forum: Python Dec 6th, 2008 |
| Replies: 1 Views: 403 I'm trying to get reflection to work in Python. I'm used to it in java but am having trouble getting it to work in python. Here is basically the code I have.
c = myObject.__class__ # get the... |
Forum: Python Dec 6th, 2008 |
| Replies: 5 Views: 1,518 I think what I need to see is a good tutorial on python reflection |
Forum: Python Dec 6th, 2008 |
| Replies: 5 Views: 1,518 If you look at the names of the objects, they are from org.python.proxies.main. So it seems that the java code gets the class from the python script and then tries to make the object but can't find... |
Forum: Python Dec 6th, 2008 |
| Replies: 5 Views: 1,518 For some reason it only gives me this:
Traceback (innermost last):
(no code object) at line 0
ImportError: no module named main
But if I change the java code to explicitly use the default... |
Forum: Python Dec 6th, 2008 |
| Replies: 5 Views: 1,518 Hey all,
What does it mean when you get an error that says ImportError: no module named main. I wasn't aware I was trying to import a module named main. I don't even have a module named main.
... |
Forum: Python Dec 2nd, 2008 |
| Replies: 3 Views: 605 That makes sense. Works now! Thanks |
Forum: Python Dec 2nd, 2008 |
| Replies: 3 Views: 605 This is probably an easy problem to solve but I'm having a bit of difficulty. The error is UnboundLocalError: local: "switch" and that's all the error says. The line refers to the line switch = -... |
Forum: Python Nov 17th, 2008 |
| Replies: 2 Views: 427 The problem with doing it the way I'm doing it is that I'm trying to instantiate lots of ball objects but the listener is only getting applied to the last one. I think it's because I'm redeclaring... |
Forum: Python Nov 16th, 2008 |
| Replies: 2 Views: 427 Hello,
I'm using Java and Python together with Jython and I'm having trouble with some python syntax. I have a custom listener that I want to add to an object. Usually I'd do it like this:
... |
Forum: Python Nov 6th, 2008 |
| Replies: 2 Views: 426 I can't really seem to find a jython forum and this question is somewhere between a jython and a python question.
I'm trying to get a java Scanner in python. So in java I say... |
Forum: Python Oct 17th, 2008 |
| Replies: 3 Views: 404 so sort uses the __lt__ method? What does the __cmp__ method get used for then? |
Forum: Python Oct 17th, 2008 |
| Replies: 3 Views: 404 I'm new to python and I'm having trouble trying to sort a list correctly. I have a map of strings->Word objects. A word object contains a list of all the places in a file where the word occurs. So... |
Forum: Python Oct 17th, 2008 |
| Replies: 8 Views: 720 Ah I see, I have to use re and sub |
Forum: Python Oct 16th, 2008 |
| Replies: 8 Views: 720 According to docs, strip is supposed to remove all leading and trailing occurrences of characters. So if I t = 'abc123' then shouldn't t.strip('[a-z]') remove all of the leading characters a-z? It... |
Forum: Python Oct 16th, 2008 |
| Replies: 8 Views: 720 Does anyone have a good beginner resource guide to regular expressions in Python? I'm used to them in java. For example, in java I have some regular expressions that look like this:
... |
Forum: Python Oct 16th, 2008 |
| Replies: 2 Views: 1,027 Well it seems to work now although I'm not sure why...I commented out the line and uncommented it a little bit later. I'm using eclipse. Maybe I should have forced it to compile or something. |
Forum: Python Oct 16th, 2008 |
| Replies: 2 Views: 1,027 I'm having some trouble getting importing stuff from another class, I think I may be doing it wrong.
I have a simple main class called Test and at the top I say:
from WordFixer import... |
Forum: Python Oct 15th, 2008 |
| Replies: 3 Views: 423 I understand that main(sys.argv) calls the main method and provides (sys.argv) as argument. This I found out with a few google searches except things look a little different, some code I've looked... |
Forum: Python Oct 15th, 2008 |
| Replies: 3 Views: 423 Hello,
I'm new to python and I'm trying to learn how to read/write programs written in python using eclipse. I'm used to java so a lot of things are familiar but a lot of things aren't and I'm... |