René's URL Explorer Experiment


Title: i2c.py, ValueError, out of range 0-256 in writing_bytes · Issue #49 · romilly/quick2wire-python-api · GitHub

Open Graph Title: i2c.py, ValueError, out of range 0-256 in writing_bytes · Issue #49 · romilly/quick2wire-python-api

X Title: i2c.py, ValueError, out of range 0-256 in writing_bytes · Issue #49 · romilly/quick2wire-python-api

Description: Not sure what causes this problem, but I'd though it might be useful to at least post an issue report. I tried using the quick2wire library with a cheap accelerometer by running the following code: from i2clibraries import i2c_adxl345 ad...

Open Graph Description: Not sure what causes this problem, but I'd though it might be useful to at least post an issue report. I tried using the quick2wire library with a cheap accelerometer by running the following code:...

X Description: Not sure what causes this problem, but I'd though it might be useful to at least post an issue report. I tried using the quick2wire library with a cheap accelerometer by running the following c...

Opengraph URL: https://github.com/romilly/quick2wire-python-api/issues/49

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"i2c.py, ValueError, out of range 0-256 in writing_bytes","articleBody":"Not sure what causes this problem, but I'd though it might be useful to at least post an issue report.\nI tried using the quick2wire library with a cheap accelerometer by running the following code:\n\n``` python\nfrom i2clibraries import i2c_adxl345\nadxl345 = i2c_adxl345.i2c_adxl345(0)\n```\n\nBut immediately I get the following error:\n\n```\nTraceback (most recent call last):\n  File \"./test1.py\", line 6, in \u003cmodule\u003e\n    adxl345 = i2c_adxl345.i2c_adxl345(0)\n  File \"/home/pi/projectfolder/i2clibraries/i2c_adxl345.py\", line 100, in __init__\n    self.setActivityThreshold()\n  File \"/home/pi/projectfolder/i2clibraries/i2c_adxl345.py\", line 178, in setActivityThreshold\n    self.setOption(self.ActivityThreshold, intervals)\n  File \"/home/pi/projectfolder/i2clibraries/i2c_adxl345.py\", line 230, in setOption\n    self.bus.write_byte(register, options)\n  File \"/home/pi/projectfolder/i2clibraries/i2c.py\", line 14, in write_byte\n    writing_bytes(self.addr, *bytes))\n  File \"/home/pi/projectfolder/quick2wire-python-api/quick2wire/i2c.py\", line 97, in writing_bytes\n    return writing(addr, bytes)\n  File \"/home/pi/projectfolder/quick2wire-python-api/quick2wire/i2c.py\", line 108, in writing\n    buf = bytes(byte_seq)\nValueError: bytes must be in range(0, 256)\n```\n\nPrinting these values, I noticed at least one of them indeed isn't in this range: -3\n\nAs a quick hack I changed the function in i2c.py so it clamps the values in byte_seq before returning the message, after which everything works perfectly.\n\n``` python\ndef writing(addr, byte_seq):\n    lst = list(byte_seq)\n    for i in range(0, len(lst)):\n        lst[i] = max(0, min(255, lst[i]))\n    byte_seq = tuple(lst)\n    buf = bytes(byte_seq)\n    return _new_i2c_msg(addr, 0, create_string_buffer(buf, len(buf)))\n```\n","author":{"url":"https://github.com/javl","@type":"Person","name":"javl"},"datePublished":"2013-12-14T16:12:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/49/quick2wire-python-api/issues/49"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:03e913fc-7c77-b9c7-89ee-206e944a507a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEAF6:20CE0B:86E447:B6CB8F:697316E5
html-safe-nonce6a7b92073dde205cc45f31daafe5c65c5b394039b6fcd3a6c2a73cd15126583e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUY2OjIwQ0UwQjo4NkU0NDc6QjZDQjhGOjY5NzMxNkU1IiwidmlzaXRvcl9pZCI6IjI3NDgzOTczODYwNTU0ODkyNTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac35bba2e6c5270ccf945adfd851a52d745af86dcedfc1f84d832e8e740fa11cef
hovercard-subject-tagissue:24294526
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/romilly/quick2wire-python-api/49/issue_layout
twitter:imagehttps://opengraph.githubassets.com/78e23b96eb41e414fdc60b4fe14a3ee453b7f65fc856fa2534019f711602cab9/romilly/quick2wire-python-api/issues/49
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/78e23b96eb41e414fdc60b4fe14a3ee453b7f65fc856fa2534019f711602cab9/romilly/quick2wire-python-api/issues/49
og:image:altNot sure what causes this problem, but I'd though it might be useful to at least post an issue report. I tried using the quick2wire library with a cheap accelerometer by running the following code:...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejavl
hostnamegithub.com
expected-hostnamegithub.com
None44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4
turbo-cache-controlno-preview
go-importgithub.com/romilly/quick2wire-python-api git https://github.com/romilly/quick2wire-python-api.git
octolytics-dimension-user_id149310
octolytics-dimension-user_loginromilly
octolytics-dimension-repository_id4207383
octolytics-dimension-repository_nworomilly/quick2wire-python-api
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id4207383
octolytics-dimension-repository_network_root_nworomilly/quick2wire-python-api
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea5e2b48bd1260476599758f5d253b5d24092ab84
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues/49#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fromilly%2Fquick2wire-python-api%2Fissues%2F49
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fromilly%2Fquick2wire-python-api%2Fissues%2F49
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=romilly%2Fquick2wire-python-api
Reloadhttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues/49
Reloadhttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues/49
Reloadhttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues/49
romilly https://patch-diff.githubusercontent.com/romilly
quick2wire-python-apihttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fromilly%2Fquick2wire-python-api
Fork 101 https://patch-diff.githubusercontent.com/login?return_to=%2Fromilly%2Fquick2wire-python-api
Star 291 https://patch-diff.githubusercontent.com/login?return_to=%2Fromilly%2Fquick2wire-python-api
Code https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api
Issues 25 https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues
Pull requests 9 https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/pulls
Actions https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/actions
Projects 0 https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/projects
Wiki https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/wiki
Security 0 https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/security
Insights https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/pulse
Code https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api
Issues https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues
Pull requests https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/pulls
Actions https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/actions
Projects https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/projects
Wiki https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/wiki
Security https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/security
Insights https://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/romilly/quick2wire-python-api/issues/49
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/romilly/quick2wire-python-api/issues/49
i2c.py, ValueError, out of range 0-256 in writing_byteshttps://patch-diff.githubusercontent.com/romilly/quick2wire-python-api/issues/49#top
https://github.com/javl
https://github.com/javl
javlhttps://github.com/javl
on Dec 14, 2013https://github.com/romilly/quick2wire-python-api/issues/49#issue-24294526
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.