Comments (15)
Hey, @kciszewski!
This is an excellent question and I'll definitely add details on that to the documentation! Thanks for asking it!
The communitysdk
is not yet available to be installed as a global module so you must save/run your script on a folder that contains the downloaded communitysdk
.
For example, when you download and unzip the community-sdk-0.1.0-python
you will see there is a folder inside it called communitysdk
. The example files will run successfully because they are "next to" this folder.
If you copy this communitysdk
to your mu_code
folder, all your scripts inside mu_code
should also be able to import the module.
I hope that answers you question. Let me know if you still have problems!
from community-sdk.
from community-sdk.
Hey, @kciszewski ! Unfortunately I haven't got your attachments. Could you maybe upload it somewhere and send the link? Or maybe paste the full error from Mu Editor?
From what you are writing I'm sure there is a problem somewhere in the library or a detail you might be missing and that is normal. This is meant to be a learning experience both ways :)
Just to make sure, have you followed this steps?
- Download the latest Python SDK release here
- Unzip the folder on a folder you can find easily
- Connect your Pixel Kit to your computer and make sure it's on
- Open Mu Editor and switch to Python 3 mode
- Load
example_pixel_kit_stream_frame.py
from the unziped folder - Press the "Run" button on the toolbar
What does the REPL prints?
from community-sdk.
from community-sdk.
Hey, @kciszewski !
Yet again, I couldn't get your attachments. You are probably replying this via email and even if you do attach things to your email response, they don't get to the Github issues where this conversation is being stored and displayed.
Could you maybe host this PDF/images somewhere else or just copy and paste the error instead?
If you have images you could potentially upload them to https://imgur.com/ for example (make sure there is no personal information on your screenshots ;) )
Or perhaps if it's a PDF you want to store it somewhere safe and send the link?
from community-sdk.
from community-sdk.
I see your problem! Thanks you for the perseverance with the attachments :)
It seems that is a specific Windows thing related to the PYTHONPATH
, an environment variable that tells the OS where to find modules. Thank you very much for finding this out! We'll definitely look into how to solve this once and for all.
Meanwhile, I believe you will have to add the folder where communitysdk
is to your PYTHONPATH
. There are several ways to do it. Here are a few entries I found on StackOverflow:
- https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows#4855685
- https://stackoverflow.com/questions/34145552/module-not-found-but-has-init-py
- https://stackoverflow.com/questions/19917492/how-to-use-pythonpath
And scenario 2 on this blog post:
Thank you again for writing us and I hope this helps. Let us know if it fixes your problem and how did you fix so we can add to the documentation :)
from community-sdk.
Hey, @kciszewski ! Did you have any luck solving this issue? I'm very curious to understand this issue as I'm not able to reproduce it on my Windows machine. Your feedback means a lot for us!
from community-sdk.
from community-sdk.
from community-sdk.
I tried setting the PYTHONPATH, but no luck. I am using Windows 7 on a Dell Inspiron. Someone surely knows what it takes to get this running. Is it possible the SDK simply isn't right or complete?
from community-sdk.
Hey, @kciszewski !
My setups are:
- Ubuntu 18.04.1 on a Dell XPS 13
- Windows 10 (MSEdge image) on VirtualBox
- OSX High Sierra on a MacBook
- KanoOS on Raspberry Py 3
I'm pretty sure the problem is not on the SDK itself but you can consider your difficulty a problem on the documentation for Windows, which it seems to be the only platform this problem actually occur. I will definitely be working on improving this on the next days.
In fact, after reading more about the subject I realized Mu Editor uses a completely separated Python environment so setting the system path won't really affect the Python environment it runs. Therefore adding the following lines (as described in one of the links I sent above) on top of your script will solve your problem:
import sys,os
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
As you can see on this screenshot, this seems to work.
This issue totally went without proper attention but now it will be properly addressed with documentation and perhaps a specific example for Windows. Let me know if this works for you and thanks again for the report!
from community-sdk.
from community-sdk.
Hey, @kciszewski!
I'm really happy to hear that solved the issue. I'll definitely add this lines of code to the docs! Win for Windows users!
Regarding your other issue, the error message you sent seems to be truncated just on the most important part... I noticed that Mu sometimes truncates it so, if I could ask a favor, can you run it again and see if you get the full Traceback?
By the way, the Traceback will, usually tell you exactly the line that is giving you this issue and it's very likely will explain the bug!
File "c:\users\ken\mu_code\communitysdk\rpcclient.py", line 76, in rpc_request
self.loop.run_until_complete(tasks)
This is the last file inside the SDK where I see the issue and if we look at the code it will show that the tasks
are:
tasks = asyncio.gather(
self.send(request_str),
self.wait_for_response(id)
)
Both methods send
and wait_for_response
are above in this file and I will assume it's either a connection problem, a serial write, a timeout or an unexpected response from the serial port... But it's hard to tell with the truncated Traceback.
from community-sdk.
It seems that the main problem of this issue was fixed and what you are struggling now looks more with this other issue:
So for matter of helping me to keep it organised, would you mind to close this issue and move the discussion about it to the issue above? :)
from community-sdk.
Related Issues (20)
- python library: get_x functions on PIxel object not working HOT 7
- Harry Potter coding kit HOT 10
- Kickstarter HOT 5
- LED color codes. HOT 7
- Setting colors for individual LEDs on Pixel Kit HOT 1
- yarn init fails on Macs that haven't installed the Xcode command line tools HOT 4
- Python - Export to Pixel Kit HOT 2
- C# support? HOT 1
- Serial port doesn't close cleanly
- Kano LED Lightshow OS v2.1.0 HOT 4
- community-sdk pypi repo
- yarn install error HOT 3
- Harry Potter wand - writing x and y position to a csv file
- Hardware SDK (coming soon).
- community-SDK node.js methods
- Another yarn install error
- Python module and package naming HOT 17
- Windows 10 Driver for Pixel kit HOT 5
- Pixel Kit Physical settings? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from community-sdk.