1

I am trying to use create a recorder object with the python API of PJSUA.

I must admit I am stumped. I took the call.py in the example python tutorials: http://trac.pjsip.org/repos/browser/pjproject/trunk/pjsip-apps/src/python/samples/call.py

I tried to add this to the main try body after lib.start(),

​rec = lib.create_recorder(self, "/home/user1/Desktop/a.wav" ) # this is what is causing the trouble
rec1 = lib.recorder_get_slot(self, rec )

but Eclipse is complaining about "Lexical error at line 81, column 13. Encountered:"\u200b" (8203) after : ""

I then added

pj.Lib.instance().conf_connect(call_slot, ​lib.recorder_get_slot(self, rec))

inside the on_media_state method inside the MyCallCallback class.

I tried the solution here, but at least at first taught there are no strange characters randomly appearing.

What am I doing wrong? and what exactly is a lexical error in this context?

Community
  • 1
  • 1
Max Pie
  • 99
  • 2
  • 9
  • I know it should be obvious, but have you verified that your path exists ("/home/user1/Desktop/a.wav")? – suffa Dec 12 '12 at 21:21
  • 1
    Why do you have spaces before all of your close-parens? Besides being generally against standard Python style, I suspect that in this case it's directly related to your problem—you somehow got a zero-width space as well as the normal space between the `"` and the `)`. Also, are you doing all of your editing in Eclipse, or have you been editing sort files in Write/Wordpad, Word, or the like? – abarnert Dec 12 '12 at 21:32
  • 2
    See this link: http://superuser.com/questions/207207/how-can-i-delete-u200b-zero-width-space-using-sed – suffa Dec 12 '12 at 21:40
  • @abarnert This was it. I used leafpad in Linux and Notepad++ on windows. I just rewrote the few lines I needed in Eclipse and the problem disappeared – Max Pie Dec 12 '12 at 22:35
  • Glad it worked. I'm a little surprised that either leafpad (designed as a dead-simple plain-text-only editor) or Notepad++ (designed as a programmer's editor) would cause this problem, but anyway, that's not the important question here. – abarnert Dec 12 '12 at 22:40

1 Answers1

3

The reference to \u200b sounds like it means Unicode character U+200B ZERO WIDTH SPACE. This is not a usual character to find in Python language source code.

Do you use any keyboards or input methods for non-European languages? Then you might have accidentally typed or pasted in text with a zero width space.

Try this: carefully set your input system to English or a European language. Re-type line 81. Then delete all of old line 81. By doing this, you eliminate the Zero Width Space, and replace it by Python source code which does what you intended.

Jim DeLaHunt
  • 10,960
  • 3
  • 45
  • 74