Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 2.7 or later is asking for me to encode #5

Open
vprithiviraj opened this issue Oct 5, 2016 · 19 comments
Open

python 2.7 or later is asking for me to encode #5

vprithiviraj opened this issue Oct 5, 2016 · 19 comments

Comments

@vprithiviraj
Copy link

vprithiviraj commented Oct 5, 2016

when i'm trying to get the chip information by using cc_info.py through cygwin or command prompt terminal. it is telling that
unicode strings are not supported, please encode to bytes: '▒\x00\x00\x00
It is telling encode to bytes. Not able to identify what is the error happened only i'm new to the python language help me in some way.

@wavesoft
Copy link
Owner

wavesoft commented Oct 5, 2016

Hello @vprithiviraj , can you tell me on which file is this error? Unfortunately I don't have any windows machine around and I cannot debug this.

@vprithiviraj
Copy link
Author

here with i attached which are all the lines the terminal is showing like that. i tried to run in cygwin terminal. there i didn't get the detailed information about those things. so i did wite the MS command prompt and gave you as a screenshot.

thanks in advance
q2

@wavesoft
Copy link
Owner

wavesoft commented Oct 5, 2016

Ok, it looks that there is a system exception somewhere and the error message is not on english. I guess you are using a non-english windows system?

For a quick solution, I would say to open cc_info.py, go to line 30 and change what's in the print parenthesis with:

("uERROR: %s" % unicode(e))

let me know if this helps

@vprithiviraj
Copy link
Author

vprithiviraj commented Oct 5, 2016

python 2.7.11 is recommended only know?

I have to install that package first dude..

@wavesoft
Copy link
Owner

wavesoft commented Oct 5, 2016

Yes, I could spend some time to make this code compatible with python 3.x there is not much work needed. Thanks for reporting this 👍

@vprithiviraj
Copy link
Author

thanks for your patience. Actually it took some time for installation of python 2.7.11. now the different error came comparing before. i hope u can understand by below screenshot
q3

@wavesoft
Copy link
Owner

wavesoft commented Oct 5, 2016

It looks you are missing the serial python module. Make sure to run the following in the project folder in order to install everything:

pip install -r requirements.txt

Ps. Check this section on the readme: https://github.com/wavesoft/CCLib#2-prepare-your-software

@vprithiviraj
Copy link
Author

vprithiviraj commented Oct 6, 2016

i have installed the pyserial using the above mentioned command before only. but still that error is coming.

i downloaded separate pyserial as exe format and installed after that also same error.

@wavesoft
Copy link
Owner

wavesoft commented Oct 6, 2016

It sounds like PYTHONPATH is not defined in your environment, so python doesn't know where to look for modules. Have a look here: https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7

@vprithiviraj
Copy link
Author

vprithiviraj commented Oct 6, 2016

NO.. it is not happening now also dude. same error of last screenshot i shared you

it is telling only about the module named as serial is not available. so will i be able to clear the output by adding the python script in the folder where i copied all these cc debugging python scripts.

is there any particular location i should keep all the cc debugging python scripts for make the serial to get detected??

q4

i tried with cygwin terminal also after doing all this for observing error it is giving like that. so there i found different like in the screenshot i attached above

@vprithiviraj
Copy link
Author

can you respond for this when you are free?

@wavesoft
Copy link
Owner

wavesoft commented Oct 7, 2016

Hey @vprithiviraj , it seems that something is going wrong with your python installation. From a quick google search I found this, which I am not sure it's helpful : http://stackoverflow.com/questions/18946286/python3-installed-successfully-but-cannot-be-opened-in-terminal

So, one thing to check is that your PYTHONPATH variable points to the same version of the directory that your python version. Ex. dont use the Python 3.x modules when running Python 2.x.

One last thing that you could try is to use virtualenv to create an isolated environment with only what you want, properly installed:

  • Go to the project folder and type virtualenv env
  • This will create a folder env that contains a sandboxed version of the python modules
  • Activate that environment, typing env\Scripts\activate
  • Install again the correct modules typing pip install -r requirements.txt
  • Try to run the scripts again (try also running them like python ci_info.py COM12)
  • When you are done, close the window or type deactivate to deactivate the sandbox

@vprithiviraj
Copy link
Author

today i cleared all my python errors araised. but not it is telling could not read from the serial port. So what can be possibilities for this??

@wavesoft
Copy link
Owner

wavesoft commented Oct 7, 2016

A few things:

  1. First the obvious, make sure it's correctly connected and you see the COM port in the windows devices.
  2. Make sure you are using the correct port (use the arduino IDE -> Open the Serial Monitor and see if it succeeds).
  3. Make sure you have flashed the correct thing to your arduino.

Also, can you paste a screenshot with the error. I want to see if this is an exception or an error with your set-up.

@vprithiviraj
Copy link
Author

vprithiviraj commented Oct 12, 2016

Hi, i was not able to get back to my work bcoz of festival holidays. now i have shared the screenshot of the error. kindly look into that.
q5

when i didn't connect the arduno Uno, the com port the error will look like the second response

And also i'm doubtful that i'm using HM-10 breakout module for this work. if any inbulit HM-10 firmware is dumped in the breakout board. then whether it will make any restrictions to read the information from the Chip???

@vprithiviraj
Copy link
Author

Hi Mr.wavesoft, Can you look into my problem? is there any possibility problem with the arduino sketch i dumped in Arduino Uno. Please let me know if you found any solution for this.

Thanks in advance.

@wavesoft
Copy link
Owner

Hello @vprithiviraj . From both of these errors it looks that there is something wrong with the communication between your PC and your Arduino. Unfortunately I haven't tested this code on windows and I am not 100% sure that this is not purely a library issue.

What I see is the following:

  1. The cc_info.py opens the COM11 port successfully
  2. The program sends a PING message. From the looks of it, the transmission succeeded
  3. Then it tries to read a response, but it reads nothing (perhaps the other end closed the port?). That's why you see the Could not read from the serial port! error.
  4. Then either the library doesn't close the port properly, or the Arduino board has some failure and when it tries to open the port again, it fails with Could not open port COM11 error.

Just to confirm, you have flashed the CCLib_proxy example to your Arduino right?
Something else you can try is to close the Arduino IDE before trying to run the cc_info.py, just in case it keeps some COM port open.

@wavesoft
Copy link
Owner

Hey @vprithiviraj , did you have any success eventually? I will get access to a windows computer soon, so I can properly debug this on windows tool. Otherwise, I will close this issue.

@vprithiviraj
Copy link
Author

vprithiviraj commented Dec 25, 2016

did you have any success eventually?

no I have not got any success. COM port error only use to come for me always

i bought the module from
https://www.fasttech.com/products/0/10004051/3875400-cc2541-bluetooth-4-0-ble-transparent-serial-data
this module is having inbuilt HM-10 firmware. Will that firmware disturb our operation. actually before i thought our process will erase and write our new program inside. but, now i'm suspecting that one may create the issue of COM port error. @wavesoft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants