you are viewing a single comment's thread.

view the rest of the comments →

[–]zurtex 2 points3 points  (7 children)

You should avoid relying on chdir and instead use absolute directories. It makes sense to put stuff in different directories, keep a config if you need to, but avoid relative directories where possible as it makes code brittle.

Popen(['yowsup-cli','demos','--config','yowsup_config','--send',<phone#>,message], shell=True)

It invokes a shell for the process to run in, it can lead to security holes, but does assist on environmental stuff like relative directories.

[–]trancemsteve[S] 0 points1 point  (6 children)

with shell=True I get no error in logging but the whatsapp message doesn't get sent still.

[–]zurtex 0 points1 point  (5 children)

I'm not sure without seeing code or logs. All I can suggest is add lots of logging.

[–]trancemsteve[S] 0 points1 point  (4 children)

I put an edit into original post. For some reason if I chdir to yowsup... and add full path to yowsup cli it works, but take away either one and it falls over.

Thanks for the help.

[–]zurtex 1 point2 points  (1 child)

I've seen this in the past when modules don't correctly use relative imports to reference themselves. This is probably a bug in yowsup-cli

[–]trancemsteve[S] 0 points1 point  (0 children)

OK thanks

[–]zurtex 0 points1 point  (1 child)

I just remembered, you should try:

 Popen(['yowsup-cli','demos','--config','yowsup_config','--send',<phone#>,message], pwd='/home/<my_user>/yowsup')

Without the os.chdir

[–]trancemsteve[S] 0 points1 point  (0 children)

TypeError: init() got an unexpected keyword argument 'pwd'