{"id":9895,"date":"2023-12-27T05:55:08","date_gmt":"2023-12-27T02:25:08","guid":{"rendered":"https:\/\/rasanegar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/"},"modified":"2023-12-27T05:55:08","modified_gmt":"2023-12-27T02:25:08","slug":"%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c","status":"publish","type":"post","link":"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/","title":{"rendered":"\u062e\u0637\u0627\u06cc \u00abAttributeError: \u0634\u06cc \u0645\u0627\u0698\u0648\u0644 \u0641\u0627\u0642\u062f \u0648\u06cc\u0698\u06af\u06cc \u00abSerial\u00bb \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0633\u062a \u0631\u0627 \u0628\u0631\u0637\u0631\u0641 \u06a9\u0646\u06cc\u062f"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">\u0633\u0631\u0641\u0635\u0644\u0647\u0627\u06cc \u0645\u0637\u0644\u0628<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d9%85%d8%b9%d8%b1%d9%81%db%8c\" >\u0645\u0639\u0631\u0641\u06cc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d8%af%d8%b1%da%a9_attributeerror\" >\u062f\u0631\u06a9 AttributeError<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d8%b1%d9%81%d8%b9_%d8%ae%d8%b7%d8%a7\" >\u0631\u0641\u0639 \u062e\u0637\u0627<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d9%85%d8%a7%da%98%d9%88%d9%84_correct_pyserial_%d8%b1%d8%a7_%d9%86%d8%b5%d8%a8_%da%a9%d9%86%db%8c%d8%af\" >\u0645\u0627\u0698\u0648\u0644 Correct pyserial \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d9%86%d8%a7%d9%85_%d9%81%d8%a7%db%8c%d9%84_serialpy_%d8%ae%d9%88%d8%af_%d8%b1%d8%a7_%d8%aa%d8%ba%db%8c%db%8c%d8%b1_%d8%af%d9%87%db%8c%d8%af\" >\u0646\u0627\u0645 \u0641\u0627\u06cc\u0644 serial.py \u062e\u0648\u062f \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/rasanegaar.com\/blog\/%d8%ae%d8%b7%d8%a7%db%8c-attributeerror-%d8%b4%db%8c-%d9%85%d8%a7%da%98%d9%88%d9%84-%d9%81%d8%a7%d9%82%d8%af-%d9%88%db%8c%da%98%da%af%db%8c-serial-%d8%af%d8%b1-%d9%be%d8%a7%db%8c\/#%d9%86%d8%aa%db%8c%d8%ac%d9%87\" >\u0646\u062a\u06cc\u062c\u0647<\/a><\/li><\/ul><\/nav><\/div>\n<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">\u0632\u0645\u0627\u0646 \u0644\u0627\u0632\u0645 \u0628\u0631\u0627\u06cc \u0645\u0637\u0627\u0644\u0639\u0647: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">\u062f\u0642\u06cc\u0642\u0647<\/span><\/span><p> <br \/>\n<\/p>\n<div class=\"mt-8 content\"><noscript><\/p>\n<style>.lazyload-placeholder { display: none;  }<\/style>\n<p><\/noscript><\/p>\n<h2 id=\"introduction\"><span class=\"ez-toc-section\" id=\"%d9%85%d8%b9%d8%b1%d9%81%db%8c\"><\/span>\u0645\u0639\u0631\u0641\u06cc<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u062d\u062a\u06cc \u0627\u06af\u0631 \u06cc\u06a9 \u062a\u0648\u0633\u0639\u0647\u200c\u062f\u0647\u0646\u062f\u0647 \u0628\u0627\u062a\u062c\u0631\u0628\u0647 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0627\u0634\u06cc\u062f\u060c \u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a \u0628\u0627 \u062e\u0637\u0627\u0647\u0627\u06cc\u06cc \u0645\u0648\u0627\u062c\u0647 \u0645\u06cc\u200c\u0634\u0648\u06cc\u062f \u06a9\u0647 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u062f \u0628\u0633\u06cc\u0627\u0631 \u06af\u06cc\u062c\u200c\u06a9\u0646\u0646\u062f\u0647 \u0628\u0627\u0634\u062f.  \u06cc\u06a9\u06cc \u0627\u0632 \u0627\u06cc\u0646 \u062e\u0637\u0627\u0647\u0627 \u0627\u06cc\u0646 \u0627\u0633\u062a <code>AttributeError: module object has no attribute 'Serial'<\/code>.  \u0627\u06cc\u0646 \u0628\u0627\u06cc\u062a \u0628\u0647 \u0634\u0645\u0627 \u062f\u0631 \u062f\u0631\u06a9 \u0648 \u062d\u0644 \u0627\u06cc\u0646 \u0645\u0634\u06a9\u0644 \u06a9\u0645\u06a9 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<h2 id=\"understandingtheattributeerror\"><span class=\"ez-toc-section\" id=\"%d8%af%d8%b1%da%a9_attributeerror\"><\/span>\u062f\u0631\u06a9 AttributeError<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0627\u06cc\u0646 <code>AttributeError<\/code> \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0632\u0645\u0627\u0646\u06cc \u06a9\u0647 \u0634\u0645\u0627 \u0633\u0639\u06cc \u0645\u06cc \u06a9\u0646\u06cc\u062f \u0628\u0647 \u06cc\u06a9 \u0648\u06cc\u0698\u06af\u06cc \u062f\u0633\u062a\u0631\u0633\u06cc \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06cc\u0627 \u0622\u0646 \u0631\u0627 \u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc \u06a9\u0646\u06cc\u062f \u06a9\u0647 \u06cc\u06a9 \u0645\u0627\u0698\u0648\u0644\u060c \u06a9\u0644\u0627\u0633 \u06cc\u0627 \u0646\u0645\u0648\u0646\u0647 \u0646\u062f\u0627\u0631\u062f\u060c \u0627\u0641\u0632\u0627\u06cc\u0634 \u0645\u06cc \u06cc\u0627\u0628\u062f.  \u0628\u0647 \u0637\u0648\u0631 \u062e\u0627\u0635\u060c \u062e\u0637\u0627 <code>AttributeError: module object has no attribute 'Serial'<\/code> \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f \u06a9\u0647 \u0634\u0645\u0627 \u062f\u0631 \u062d\u0627\u0644 \u062a\u0644\u0627\u0634 \u0628\u0631\u0627\u06cc \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 <code>Serial<\/code> \u0648\u06cc\u0698\u06af\u06cc \u0627\u0632 \u0645\u0627\u0698\u0648\u0644\u06cc \u06a9\u0647 \u0622\u0646 \u0631\u0627 \u0646\u062f\u0627\u0631\u062f.<\/p>\n<p>\u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0645\u062b\u0627\u0644\u060c \u0627\u06af\u0631 \u0645\u0627\u0698\u0648\u0644\u06cc \u0628\u0647 \u0646\u0627\u0645 \u062f\u0627\u0631\u06cc\u062f <code>serial<\/code> \u0648 \u0634\u0645\u0627 \u0633\u0639\u06cc \u0645\u06cc \u06a9\u0646\u06cc\u062f \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f <code>Serial<\/code> \u0648\u06cc\u0698\u06af\u06cc \u0627\u0632 \u0622\u0646\u060c \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0628\u0627 \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0645\u0648\u0627\u062c\u0647 \u0634\u0648\u06cc\u062f.  \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0627\u0633\u062a:<\/p>\n<pre><code class=\"hljs\"><span class=\"hljs-keyword\">import<\/span> serial\n\nser = serial.Serial(<span class=\"hljs-string\">'\/dev\/ttyUSB0'<\/span>)  <span class=\"hljs-comment\"># This line causes the error<\/span>\n<\/code><\/pre>\n<p>\u062f\u0631 \u0627\u06cc\u0646 \u0645\u0648\u0631\u062f\u060c <code>serial<\/code> \u0645\u0627\u0698\u0648\u0644\u06cc \u06a9\u0647 \u0648\u0627\u0631\u062f \u0645\u06cc \u06a9\u0646\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0646\u062f\u0627\u0631\u062f <code>Serial<\/code> \u0635\u0641\u062a\u060c \u0627\u0632 \u0627\u06cc\u0646 \u0631\u0648 <code>AttributeError<\/code>.<\/p>\n<div class=\"alert alert-note\">\n<div class=\"flex\">\n<div class=\"flex-shrink-0 mr-3\"><\/div>\n<div class=\"w-full\">\n<p><strong>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f:<\/strong> \u062f\u0631\u06a9 \u0627\u06cc\u0646 \u0646\u06a9\u062a\u0647 \u0645\u0647\u0645 \u0627\u0633\u062a \u06a9\u0647 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0647 \u062d\u0631\u0648\u0641 \u06a9\u0648\u0686\u06a9 \u0648 \u0628\u0632\u0631\u06af \u062d\u0633\u0627\u0633 \u0627\u0633\u062a. <code>Serial<\/code> \u0648 <code>serial<\/code> \u0633\u0644\u0627\u0645.  \u0627\u06af\u0631 \u0645\u0634\u062e\u0635\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u062f \u0627\u0645\u0627 \u0627\u0632 \u062d\u0627\u0644\u062a \u0627\u0634\u062a\u0628\u0627\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u062f\u060c \u0628\u0627 \u06cc\u06a9 \u0646\u06cc\u0632 \u0645\u0648\u0627\u062c\u0647 \u062e\u0648\u0627\u0647\u06cc\u062f \u0634\u062f <code>AttributeError<\/code>.<\/p>\n<\/p><\/div><\/div><\/div>\n<h2 id=\"fixesfortheerror\"><span class=\"ez-toc-section\" id=\"%d8%b1%d9%81%d8%b9_%d8%ae%d8%b7%d8%a7\"><\/span>\u0631\u0641\u0639 \u062e\u0637\u0627<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u062e\u0628\u0631 \u062e\u0648\u0628 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u06cc\u06a9 \u0631\u0627\u0647 \u062d\u0644 \u0628\u0633\u06cc\u0627\u0631 \u0622\u0633\u0627\u0646 \u0627\u0633\u062a\u060c \u062d\u062a\u06cc \u0627\u06af\u0631 \u062f\u0631 \u0627\u0628\u062a\u062f\u0627 \u0628\u0633\u06cc\u0627\u0631 \u06af\u06cc\u062c \u06a9\u0646\u0646\u062f\u0647 \u0628\u0647 \u0646\u0638\u0631 \u0628\u0631\u0633\u062f.  \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0631\u062e\u06cc \u0627\u0632 \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627 \u0631\u0627 \u0628\u0631\u0631\u0633\u06cc \u06a9\u0646\u06cc\u0645.<\/p>\n<h3 id=\"installthecorrectpyserialmodule\"><span class=\"ez-toc-section\" id=\"%d9%85%d8%a7%da%98%d9%88%d9%84_correct_pyserial_%d8%b1%d8%a7_%d9%86%d8%b5%d8%a8_%da%a9%d9%86%db%8c%d8%af\"><\/span>\u0645\u0627\u0698\u0648\u0644 Correct pyserial \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u06cc\u06a9\u06cc \u0627\u0632 \u0631\u0627\u06cc\u062c \u062a\u0631\u06cc\u0646 \u062f\u0644\u0627\u06cc\u0644 \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0646\u0635\u0628 \u0646\u0627\u062f\u0631\u0633\u062a \u0622\u0646 \u0627\u0633\u062a <code>pyserial<\/code> \u0645\u062f\u0648\u0644.  \u0627\u06cc\u0646 <code>Serial<\/code> \u0648\u06cc\u0698\u06af\u06cc \u0628\u062e\u0634\u06cc \u0627\u0632 <code>pyserial<\/code> \u0645\u0627\u0698\u0648\u0644 \u06a9\u0647 \u0628\u0631\u0627\u06cc \u0627\u0631\u062a\u0628\u0627\u0637 \u0633\u0631\u06cc\u0627\u0644 \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f.<\/p>\n<p>\u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0645\u0627\u0698\u0648\u0644\u06cc \u0628\u0647 \u0646\u0627\u0645 \u0646\u0635\u0628 \u06a9\u0631\u062f\u0647 \u0628\u0627\u0634\u06cc\u062f <code>serial<\/code> \u0628\u062c\u0627\u06cc <code>pyserial<\/code> (\u0627\u06cc\u0646 \u0631\u0627\u06cc\u062c \u062a\u0631 \u0627\u0632 \u0686\u06cc\u0632\u06cc \u0627\u0633\u062a \u06a9\u0647 \u0641\u06a9\u0631 \u0645\u06cc \u06a9\u0646\u06cc\u062f!).  \u0628\u0631\u0627\u06cc \u0631\u0641\u0639 \u0627\u06cc\u0646 \u0645\u0634\u06a9\u0644\u060c \u0628\u0627\u06cc\u062f \u0645\u0627\u0698\u0648\u0644 \u0646\u0627\u062f\u0631\u0633\u062a \u0631\u0627 \u062d\u0630\u0641 \u0648 \u0645\u0627\u0698\u0648\u0644 \u0635\u062d\u06cc\u062d \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f.<\/p>\n<pre><code class=\"hljs\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> pip uninstall serial<\/span>\n<span class=\"hljs-meta\">$<\/span><span class=\"bash\"> pip install pyserial<\/span>\n<\/code><\/pre>\n<div data-nosnippet=\"\" id=\"newsletter\">\n<div class=\"bg-gray-100 border rounded my-8\">\n<div class=\"py-3 px-3 sm:px-4 lg:py-6 lg:px-6\">\n<div class=\"text-center\"><span class=\"text-xl font-extrabold tracking-tight text-gray-600 sm:text-2xl\">\u062f\u0648\u0631\u0647 \u0647\u0627\u06cc \u0631\u0627\u06cc\u06af\u0627\u0646\u060c \u067e\u0631\u0648\u0698\u0647 \u0647\u0627\u06cc \u0647\u062f\u0627\u06cc\u062a \u0634\u062f\u0647 \u0648 \u0645\u0648\u0627\u0631\u062f \u062f\u06cc\u06af\u0631 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u06a9\u0646\u06cc\u062f<\/span><\/div>\n<div class=\"mt-4\">\n<div class=\"flex justify-center\">\n<div class=\"flex-grow flex-col justify-center\">\n<form class=\"group sm:flex sm:justify-center\"><label for=\"email-address\" class=\"sr-only\">\u0622\u062f\u0631\u0633 \u0627\u06cc\u0645\u06cc\u0644<\/label><input id=\"email-address\" name=\"email-address\" type=\"email\" autocomplete=\"email\" required=\"\" class=\"flex-1 w-full sm:max-w-md px-5 py-3 border sm:border-r-0 border-gray-400 placeholder-gray-500 rounded-md sm:rounded-r-none sm:rounded-l-md focus:ring-0 focus:border-gray-900\" placeholder=\"Enter your email\" value=\"\"><\/p>\n<div class=\"mt-3 sm:mt-0 sm:flex-shrink-0\"><button type=\"submit\" class=\"w-full flex items-center justify-center px-5 py-3 rounded-md sm:rounded-l-none sm:rounded-r-md shadow border border-transparent text-base font-medium text-white bg-orange-500 hover:bg-orange-600\">\u0627\u0634\u062a\u0631\u0627\u06a9 \u062f\u0631<\/button><\/div>\n<\/form>\n<p class=\"text-center mt-3 text-sm text-gray-500\">\u0628\u062f\u0648\u0646 \u0647\u0631\u0632\u0646\u0627\u0645\u0647 \u0647\u0631\u06af\u0632.  \u0644\u063a\u0648 \u0627\u0634\u062a\u0631\u0627\u06a9 \u062f\u0631 \u0647\u0631 \u0632\u0645\u0627\u0646.  \u0645\u0627 \u0631\u0627 \u0628\u062e\u0648\u0627\u0646\u06cc\u062f<!-- --> \u0633\u06cc\u0627\u0633\u062a \u062d\u0641\u0638 \u062d\u0631\u06cc\u0645 \u062e\u0635\u0648\u0635\u06cc.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>\u067e\u0633 \u0627\u0632 \u0627\u062c\u0631\u0627\u06cc \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631\u0627\u062a\u060c \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0645\u0634\u06a9\u0644 \u0634\u0645\u0627 \u062d\u0644 \u0634\u0648\u062f.  \u0627\u06a9\u0646\u0648\u0646 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f <code>Serial<\/code> \u0627\u0632 \u062c\u0627\u0646\u0628 <code>pyserial<\/code> \u0648 \u0627\u0632 \u0622\u0646 \u062f\u0631 \u06a9\u062f \u062e\u0648\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre><code class=\"hljs\"><span class=\"hljs-keyword\">from<\/span> pyserial <span class=\"hljs-keyword\">import<\/span> Serial\n\nser = Serial(<span class=\"hljs-string\">'\/dev\/ttyUSB0'<\/span>)  <span class=\"hljs-comment\"># This line no longer causes an error<\/span>\n<\/code><\/pre>\n<p>\u0627\u06af\u0631 \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0631\u0641\u0639 \u0646\u0634\u062f\u060c \u0628\u0647 \u062e\u0648\u0627\u0646\u062f\u0646 \u0627\u062f\u0627\u0645\u0647 \u062f\u0647\u06cc\u062f.<\/p>\n<h3 id=\"renameyourserialpyfile\"><span class=\"ez-toc-section\" id=\"%d9%86%d8%a7%d9%85_%d9%81%d8%a7%db%8c%d9%84_serialpy_%d8%ae%d9%88%d8%af_%d8%b1%d8%a7_%d8%aa%d8%ba%db%8c%db%8c%d8%b1_%d8%af%d9%87%db%8c%d8%af\"><\/span>\u0646\u0627\u0645 \u0641\u0627\u06cc\u0644 serial.py \u062e\u0648\u062f \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u0628\u0627 \u062a\u0648\u062c\u0647 \u0628\u0647 \u0627\u06cc\u0646 \u06a9\u0647 \u0686\u0642\u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u062f\u0631 \u062d\u0631\u0641\u0647 \u0627\u0645 \u0646\u0648\u0634\u062a\u0647 \u0627\u0645\u060c \u0641\u06a9\u0631 \u0645\u06cc \u06a9\u0646\u06cc\u062f \u06a9\u0647 \u0628\u0647 \u0627\u0646\u062f\u0627\u0632\u0647 \u062e\u0648\u062f\u0645 \u0645\u0631\u062a\u06a9\u0628 \u0627\u06cc\u0646 \u0627\u0634\u062a\u0628\u0627\u0647 \u0633\u0627\u062f\u0647 \u0646\u0645\u06cc \u0634\u0648\u0645&#8230;<\/p>\n<p>\u0627\u062d\u062a\u0645\u0627\u0644 \u062f\u06cc\u06af\u0631 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0645\u0641\u0633\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0632\u0645\u0627\u0646\u06cc \u06a9\u0647 \u0641\u0627\u06cc\u0644\u06cc \u062f\u0631 \u0641\u0647\u0631\u0633\u062a \u067e\u0631\u0648\u0698\u0647 \u0634\u0645\u0627 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f \u0628\u0627 \u0647\u0645\u0627\u0646 \u0646\u0627\u0645 \u0645\u0627\u0698\u0648\u0644\u06cc \u06a9\u0647 \u0645\u06cc\u200c\u062e\u0648\u0627\u0647\u06cc\u062f \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f\u060c \u06af\u06cc\u062c \u0645\u06cc\u200c\u0634\u0648\u062f.  \u0627\u06cc\u0646 \u06cc\u06a9\u06cc \u062f\u06cc\u06af\u0631 \u0627\u0632 \u0645\u0646\u0627\u0628\u0639 \u0631\u0627\u06cc\u062c \u0627\u0633\u062a <code>AttributeError<\/code> \u062e\u0637\u0627<\/p>\n<p>\u0641\u0631\u0636 \u06a9\u0646\u06cc\u062f\u060c \u0628\u0631\u0627\u06cc \u0645\u062b\u0627\u0644\u060c \u0634\u0645\u0627 \u06cc\u06a9 \u0641\u0627\u06cc\u0644 \u0628\u0647 \u0646\u0627\u0645 \u062f\u0627\u0631\u06cc\u062f <code>serial.py<\/code> \u062f\u0631 \u062f\u0627\u06cc\u0631\u06a9\u062a\u0648\u0631\u06cc \u067e\u0631\u0648\u0698\u0647 \u0634\u0645\u0627 (\u06cc\u0627 \u0634\u0627\u06cc\u062f \u062e\u0648\u062f \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a \u0634\u0645\u0627 \u0646\u0627\u0645 \u062f\u0627\u0631\u062f <code>serial.py<\/code>).  \u0648\u0642\u062a\u06cc \u0633\u0639\u06cc \u0645\u06cc\u06a9\u0646\u06cc <code>import serial<\/code>\u060c \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u067e\u0627\u06cc\u062a\u0648\u0646 \u0634\u0645\u0627 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u062f <code>serial.py<\/code> \u0641\u0627\u06cc\u0644 \u0628\u0647 \u062c\u0627\u06cc <code>pyserial<\/code> \u0645\u0627\u0698\u0648\u0644\u060c \u0645\u0646\u062c\u0631 \u0628\u0647 <code>AttributeError<\/code>.<\/p>\n<p>\u0631\u0627\u0647 \u062d\u0644 \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0633\u0627\u062f\u0647 \u0627\u0633\u062a &#8211; \u0646\u0627\u0645 \u062e\u0648\u062f \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f <code>serial.py<\/code> \u0641\u0627\u06cc\u0644 \u0628\u0647 \u0686\u06cc\u0632 \u062f\u06cc\u06af\u0631\u06cc<\/p>\n<pre><code class=\"hljs\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> mv serial.py my_serial.py<\/span>\n<\/code><\/pre>\n<h2 id=\"conclusion\"><span class=\"ez-toc-section\" id=\"%d9%86%d8%aa%db%8c%d8%ac%d9%87\"><\/span>\u0646\u062a\u06cc\u062c\u0647<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u062f\u0631 \u0627\u06cc\u0646 \u0628\u0627\u06cc\u062a\u060c \u0645\u0627 \u062f\u0648 \u0639\u0644\u062a \u0631\u0627\u06cc\u062c \u0631\u0627 \u0628\u0631\u0631\u0633\u06cc \u06a9\u0631\u062f\u0647 \u0627\u06cc\u0645 <code>AttributeError: module object has no attribute 'Serial'<\/code> \u062e\u0637\u0627 \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646: \u0646\u0635\u0628 \u0627\u0634\u062a\u0628\u0627\u0647 \u0627\u0633\u062a <code>pyserial<\/code> \u0645\u0627\u0698\u0648\u0644\u060c \u0648 \u062f\u0627\u0634\u062a\u0646 \u06cc\u06a9 \u0641\u0627\u06cc\u0644 \u062f\u0631 \u0641\u0647\u0631\u0633\u062a \u067e\u0631\u0648\u0698\u0647 \u062e\u0648\u062f \u06a9\u0647 \u0646\u0627\u0645\u06cc \u0631\u0627 \u0628\u0627 \u0645\u0627\u0698\u0648\u0644\u06cc \u06a9\u0647 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u062f \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f \u0628\u0647 \u0627\u0634\u062a\u0631\u0627\u06a9 \u0628\u06af\u0630\u0627\u0631\u062f.  \u0628\u0627 \u0646\u0635\u0628 \u0645\u0627\u0698\u0648\u0644 \u0635\u062d\u06cc\u062d \u06cc\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u0646\u0627\u0645 \u0641\u0627\u06cc\u0644 \u0647\u0627\u06cc \u0645\u062a\u0646\u0627\u0642\u0636\u060c \u0628\u0627\u06cc\u062f \u0628\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0631\u0627 \u0627\u0632 \u0628\u06cc\u0646 \u0628\u0628\u0631\u06cc\u062f.<\/p>\n<\/div>\n<p><br \/>\n<br \/>\u0645\u0646\u062a\u0634\u0631 \u0634\u062f\u0647 \u062f\u0631 1402-12-27 05:55:04<br \/>\n<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;9895&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0627\u0645\u062a\u06cc\u0627\u0632 \u0634\u0645\u0627 \u0628\u0647 \u0627\u06cc\u0646 \u0645\u0637\u0644\u0628&quot;,&quot;legend&quot;:&quot;0\\\/5 (0 \u0631\u0627\u06cc)&quot;,&quot;size&quot;:&quot;30&quot;,&quot;title&quot;:&quot;\u062e\u0637\u0627\u06cc \u00abAttributeError: \u0634\u06cc \u0645\u0627\u0698\u0648\u0644 \u0641\u0627\u0642\u062f \u0648\u06cc\u0698\u06af\u06cc \u00abSerial\u00bb \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0633\u062a \u0631\u0627 \u0628\u0631\u0637\u0631\u0641 \u06a9\u0646\u06cc\u062f&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} ({count} \u0631\u0627\u06cc)&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-left: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 24px;\">\n            <span class=\"kksr-muted\">\u0627\u0645\u062a\u06cc\u0627\u0632 \u0634\u0645\u0627 \u0628\u0647 \u0627\u06cc\u0646 \u0645\u0637\u0644\u0628<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">\u0632\u0645\u0627\u0646 \u0644\u0627\u0632\u0645 \u0628\u0631\u0627\u06cc \u0645\u0637\u0627\u0644\u0639\u0647: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">\u062f\u0642\u06cc\u0642\u0647<\/span><\/span>\u0645\u0639\u0631\u0641\u06cc \u062d\u062a\u06cc \u0627\u06af\u0631 \u06cc\u06a9 \u062a\u0648\u0633\u0639\u0647\u200c\u062f\u0647\u0646\u062f\u0647 \u0628\u0627\u062a\u062c\u0631\u0628\u0647 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0627\u0634\u06cc\u062f\u060c \u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a \u0628\u0627 \u062e\u0637\u0627\u0647\u0627\u06cc\u06cc \u0645\u0648\u0627\u062c\u0647 \u0645\u06cc\u200c\u0634\u0648\u06cc\u062f \u06a9\u0647 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u062f \u0628\u0633\u06cc\u0627\u0631 \u06af\u06cc\u062c\u200c\u06a9\u0646\u0646\u062f\u0647 \u0628\u0627\u0634\u062f. \u06cc\u06a9\u06cc \u0627\u0632 \u0627\u06cc\u0646 \u062e\u0637\u0627\u0647\u0627 \u0627\u06cc\u0646 \u0627\u0633\u062a AttributeError: module object has no attribute &#8216;Serial&#8217;. \u0627\u06cc\u0646 \u0628\u0627\u06cc\u062a \u0628\u0647 \u0634\u0645\u0627 \u062f\u0631 \u062f\u0631\u06a9 \u0648 \u062d\u0644 \u0627\u06cc\u0646 \u0645\u0634\u06a9\u0644 \u06a9\u0645\u06a9 \u0645\u06cc \u06a9\u0646\u062f. \u062f\u0631\u06a9 AttributeError \u0627\u06cc\u0646 AttributeError \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0632\u0645\u0627\u0646\u06cc \u06a9\u0647 \u0634\u0645\u0627 \u0633\u0639\u06cc [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":9045,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1772,620],"tags":[2453,379,2508,1840,1938,1811,2500,1841,1744,2172,1803,2342,2445,2527,1806,2443,2322,2323,2446],"class_list":["post-9895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-programming","tag-attributeerror","tag-serial","tag--javascript","tag-1840","tag-1938","tag-1811","tag-2500","tag-1841","tag-1744","tag-2172","tag-1803","tag-2342","tag-2445","tag-2527","tag-1806","tag-2443","tag-2322","tag--node","tag-2446"],"acf":[],"_links":{"self":[{"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/posts\/9895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/comments?post=9895"}],"version-history":[{"count":0,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/posts\/9895\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/media\/9045"}],"wp:attachment":[{"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/media?parent=9895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/categories?post=9895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rasanegaar.com\/blog\/wp-json\/wp\/v2\/tags?post=9895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}