Giter Club home page Giter Club logo

Comments (15)

murilopolese avatar murilopolese commented on August 16, 2024

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.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

murilopolese avatar murilopolese commented on August 16, 2024

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?

  1. Download the latest Python SDK release here
  2. Unzip the folder on a folder you can find easily
  3. Connect your Pixel Kit to your computer and make sure it's on
  4. Open Mu Editor and switch to Python 3 mode
  5. Load example_pixel_kit_stream_frame.py from the unziped folder
  6. Press the "Run" button on the toolbar

What does the REPL prints?

from community-sdk.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

murilopolese avatar murilopolese commented on August 16, 2024

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.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

murilopolese avatar murilopolese commented on August 16, 2024

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:

And scenario 2 on this blog post:

https://www.daveoncode.com/2017/03/07/how-to-solve-python-modulenotfound-no-module-named-import-error/

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.

murilopolese avatar murilopolese commented on August 16, 2024

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.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

kciszewski avatar kciszewski commented on August 16, 2024

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.

murilopolese avatar murilopolese commented on August 16, 2024

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.

kciszewski avatar kciszewski commented on August 16, 2024

from community-sdk.

murilopolese avatar murilopolese commented on August 16, 2024

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.

murilopolese avatar murilopolese commented on August 16, 2024

It seems that the main problem of this issue was fixed and what you are struggling now looks more with this other issue:

#10

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.