Help uploading Python to c9

workspace
python

#1

Hello,
I’m trying to upload a python work space to c9 but I’m having some trouble. The project hasn’t had any issues while I was building it offline. I was using PyCharm and Python 3.5.2 as my interpreter.
For some reason, it just ceases to work in c9.

For the game, I take input such as:

: attack goblin with sword

If I run this in PyCharm, it runs it through a simple parser I wrote and calls the ‘attack’ function. If I type in the same input into c9, it throws this error.

Traceback (most recent call last):
  File "/home/ubuntu/workspace/main.py", line 196, in <module>
    line = input(": ")
  File "<string>", line 1
    attack goblin with sword
                ^
SyntaxError: invalid syntax


Process exited with code: 1

I have no idea why this is happening. I haven’t changed the code aside from making some comments. I don’t even have a file called “string”. I don’t think it can be the library string either as line 1 is just a comment.

If I put in input that doesn’t need any spaces I get other weird errors like this one.

: check
['<function', 'check', 'at', '0x7f6933590398>']
Traceback (most recent call last):
  File "/home/ubuntu/workspace/main.py", line 197, in <module>
    exe(line, verbs, nouns, exceptions, None)
  File "/home/ubuntu/workspace/reader.py", line 89, in exe
    execute(interpret(command, verb_dict, noun_dict, exceptions, override))
  File "/home/ubuntu/workspace/reader.py", line 61, in interpret
    post_verb = str(post_verb).translate(delete_chars)
TypeError: expected a character buffer object


Process exited with code: 1

If I type “check” on PyCharm, it calls the appropriate function.

Is it possible its running my code with a different interpreter? In the preferences I have Python 3 selected. I just started using it so I’m pretty confused.

Thanks in advance.


#2

I’ve resolved my issue. I can’t figure out how to delete this post though.


#3

Instead of deleting your post, it would be nice if you can provide the solution!

Glad you worked it out.


#4

OK.

I just didn’t realize you had to restart the work space for the preference changes to take effect. After I rebooted it, everything worked fine.

Thanks anyways!