简体   繁体   中英

Migrating a python script from one machine to other causes a module error

I am creating a project on Python based on yowsup. (Can be found here: https://github.com/jorgehortelano/yowsup-commandserver ) The idea is to execute commands using WhatsApp.

I have compiled in Python in my local computer (ubuntu 14.04.4 LTS). It works fine and I can communicate with my software using WhatsApp. It uses Python 2.7.6

Now I want to instal it on a Raspberry Pi 2 with an Ubuntu 15.10. It uses a Python 2.7.10.

Cloning the repository with a simple git clone in the Raspberry and trying to execute it causes:

Traceback (most recent call last):
File "./yowsup-commandserver", line 358, in <module>
if not parser.process():
File "./yowsup-commandserver", line 239, in process
self.startCommandServer()
File "./yowsup-commandserver", line 299, in startCommandServer
stack = commandserver.YowsupCommandServerStack(credentials, allowed_users, not self.args["unmoxie"])
AttributeError: 'module' object has no attribute 'YowsupCommandServerStack'

I can understand that the module can be defined incorrectly, because I am a beginner with python, but I cannot understand why is executing correctly in my desktop computer and not in the Raspberry Pi.

I do not expect that somebody fix it to me, I only want to understand why the module is not loading correctly when moving from one machine to the other.

I think you are experiencing version/dependency problems. This problem could be easily solved using virtualenv . Install the same Python version and keep all the dependencies in a requirements.txt file and it should work in any machine using the virtualenv Python instead of your OS Python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM