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
1bad79fd
Commit
1bad79fd
authored
May 27, 2013
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made IP connection errors emit the same kind of error as serial connection errors.
parent
b99aa3a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
printcore.py
printcore.py
+14
-13
No files found.
printcore.py
View file @
1bad79fd
...
@@ -451,21 +451,22 @@ class printcore():
...
@@ -451,21 +451,22 @@ class printcore():
if
self
.
sendcb
:
if
self
.
sendcb
:
try
:
self
.
sendcb
(
command
)
try
:
self
.
sendcb
(
command
)
except
:
pass
except
:
pass
try
:
# If the printer is connected via Ethernet, use send
# If the printer is connected via Ethernet, use send
if
is_socket
(
self
.
printer
):
if
is_socket
(
self
.
printer
):
msg
=
str
(
command
+
"
\n
"
)
msg
=
str
(
command
+
"
\n
"
)
totalsent
=
0
totalsent
=
0
while
totalsent
<
len
(
msg
):
while
totalsent
<
len
(
msg
):
sent
=
self
.
printer
.
send
(
msg
[
totalsent
:])
sent
=
self
.
printer
.
send
(
msg
[
totalsent
:])
if
sent
==
0
:
if
sent
==
0
:
raise
RuntimeError
(
"socket connection broken"
)
raise
RuntimeError
(
"socket connection broken"
)
totalsent
=
totalsent
+
sent
totalsent
=
totalsent
+
sent
else
:
else
:
try
:
self
.
printer
.
write
(
str
(
command
+
"
\n
"
))
self
.
printer
.
write
(
str
(
command
+
"
\n
"
))
except
SerialException
,
e
:
except
SerialException
,
e
:
print
"Can't write to printer (disconnected?)."
print
"Can't write to printer (disconnected?)."
except
RuntimeError
,
e
:
print
"Socket connection broken, disconnected."
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
baud
=
115200
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