Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
b444ebcd
Commit
b444ebcd
authored
Feb 25, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the exceptions raised when printer is disconnected.
parent
7a1ccb8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
printcore.py
printcore.py
+8
-2
No files found.
printcore.py
View file @
b444ebcd
...
...
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
from
serial
import
Serial
from
serial
import
Serial
,
SerialException
from
threading
import
Thread
from
select
import
error
as
SelectError
import
time
,
getopt
,
sys
...
...
@@ -100,6 +100,9 @@ class printcore():
break
else
:
raise
except
SerialException
,
e
:
print
"Can't read from printer (disconnected?)."
break
if
(
len
(
line
)
>
1
):
self
.
log
+=
[
line
]
...
...
@@ -279,7 +282,10 @@ class printcore():
self
.
sendcb
(
command
)
except
:
pass
self
.
printer
.
write
(
str
(
command
+
"
\n
"
))
try
:
self
.
printer
.
write
(
str
(
command
+
"
\n
"
))
except
SerialException
,
e
:
print
"Can't write to printer (disconnected?)."
if
__name__
==
'__main__'
:
baud
=
115200
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment