Python on Raspberry Pi 3 [closed] - python

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am trying to code a RFID access system that utilizes an actuator to turn on and off. I followed a simple tutorial that can be found here.
I completed the tutorial fully and now have encountered problems:
I noticed when following the tutorial, the "python" we were coding was different from actual Python... for example, we don't do the curly brackets to end anything. Is there a way I can program and have access to my RFID module with the normal "Python" that I learned?
I am having issues finding the syntax's attached to SimpleMFRC522, because from what I read, it is a simplified way to interact with the RFID reader. So shouldn't there be certain syntax/functions attached to it?
When running a simple program that reads a tags ID and TEXT associated with the tag, I come across errors that usually wouldn't be an error on the normal python, for example...
Python Code
After running that code (labeled 'Python Code'), I come across...
Actual Error
I am extremely confused and need guidance or referral to anything I could possibly learn to help me finish this project. All or any help is appreciated and seriously considered.

Similar issue to this post.
You cannot concatenate a string and an integer so you must pull the id out of the object then typecast it to a string:
unsure what the 'id' name is within the object but let's assume it's 'id'
... (code above)
try:
print('Place your tag to be read.')
id_obj, text = reader.read()
print('Your ID is ' + str(id_obj.id))
print('Your text is ' + text)
... (code below)

Related

TD ameritrade access token [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 days ago.
Improve this question
Good morning all, I am struggling with TD ameritrade’s authentication process, specifically the 30 min life span of the bearer key.
I have written a Python script to run the authentication process (https://developer.tdameritrade.com/content/simple-auth-local-apps). It’s partially automated, except for the pause to deal with the two step verification (which I can’t work around).
The trouble I have is that if the bearer key needs to be updated every 30 minutes, and the process script isn’t fully automated, it defeats the purpose of having a bot that can run and execute trades.
I see references to a refresh key, but not sure how to implement.
so far I have tried forums, YouTube , and reaching out to others within my network.
Any help is appreciated

How to have a % in a python statement without using two % [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
so my python application opens a link that would be found in my config file. I would like to make it so it would like to allow it to go to the website without doubling the %. Heres what I would want config.get('CONFIG', 'Website') the web address has a bunch of %'s in the link but when I run it, the process ends
I'm assuming you are using the configparser module?
If so, you can use ConfigParser(interpolation=None) to disable string interpolation (which controls the behavior of % characters in the config file).
(Or on older versions of Python, you may need to use RawConfigParser instead.)

Python: Scraping special Characters Writing to CSV [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Hello I am trying to scrape a website and its going fine, till the point I try to save the data into a csv via csv module writer. I traced back to the data and find out that 7 años is the string which isn't allowing the data to store properly.
I READ A LOT ON THIS TOPIC BEFORE POSTING... BUT COULDN'T GRASP THE CONCEPT.
Python is throwing some encoding error which got me to reading and I found that csv module isn't capable of unicode.
Is there any suggestion?
Try to use following solution
def sanitize_string(string):
return string.replace('\t', '')
Try to encode the string using encode function
your_variable = sanitize_string("your string")
your_variable.encode('utf8')
Hope this will help you.

Using regex to ignore invalid syntax [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
https://regex101.com/r/jK9mH3/1
That's the link to my regex, in order to not take up all the page i put it there, im trying to make it output a0, then a-z then aa-aq.
EDIT: Ok that was terrible im sorry, i need to run a program which checks the variable names of all dictionaries, but it wont be basic, i need it to check all different types of syntax like the ones listed in the checker, so it needs to be able to recognize that d = "{}" isnt actually a dictionary that its a string and that #z = {} is a comment not a dictionary. The output on the website will be a0, then a-z with no random z's in-between and then aa-aq (that is, aa, ab, ac, ad etc.)
Although your question doesn't make a lot of sense, I believe that you're trying to detect valid python syntax in a given string.
Do NOT use regular expression for this. Use a lexer/parser for this. It's designed to handle the complex structures found in a language like python.
Guide to Lexing and Parsing

Recognising # symbol within Python Code as Code Not Comment [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am currently putting some code together to create a TCP/IP client which will have to communicate with an existing network server (Local not Internet). The server code is out of my control as it is already in place. I seem to have test code that works, at least the server recognises that a client with the relevant IP address is making a connection, however, on first connection the server sends out an Identify command to confirm the client is valid:
IDENTIFY_#
This is my problem. The client code has to be written in Python and obviously #'s seem to create an issue. My understanding (being new to Python) is that they are only used for comments and all of the posts and books I have read seem to say the same. Unfortunately I have to respond with strings that also possess #'s as termination characters for data sets so it makes things twice as problematic. Is it possible to get Python to recognise a # for what it is and not throw a wobbly because it assumes it is a comment?
If the # symbol is within a string literal, it shouldn't be interpreted as a comment.

Categories

Resources