Skip to content

Commit d41ede5

Browse files
committed
Debugging: use logging rather than print
1 parent c3b76ee commit d41ede5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pandas/io/formats/csvs.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ def save(self):
134134
encoding = self.encoding
135135

136136
# GH 21227 internal compression is not used when file-like passed.
137-
print('debug_3', self.compression)
138-
print('debug_4', self.path_or_buf)
139-
print('debug_5', hasattr(self.path_or_buf, 'write'))
137+
import logging
138+
logging.warning('debug_3: {}'.format(self.compression))
139+
logging.warning('debug_4: {}'.format(self.path_or_buf))
140+
logging.warning('debug_5: {}'.format(hasattr(self.path_or_buf, 'write')))
140141
if self.compression and hasattr(self.path_or_buf, 'write'):
142+
logging.warning('debug_6: in loop, should RuntimeWarn')
141143
msg = ("compression has no effect when passing file-like "
142144
"object as input.")
143145
warnings.warn(msg, RuntimeWarning, stacklevel=2)

pandas/tests/test_common.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ def test_compression_warning(compression_only):
257257
[12.32112, 123123.2, 321321.2]],
258258
columns=['X', 'Y', 'Z'])
259259
with tm.ensure_clean() as filename:
260-
print('debug_1', compression_only)
260+
import logging
261+
logging.warning('debug_1: {}'.format(compression_only))
261262
f, _handles = _get_handle(filename, 'w', compression=compression_only)
262263
with tm.assert_produces_warning(RuntimeWarning,
263264
check_stacklevel=False):
264265
with f:
265-
print('debug_2', compression_only)
266+
logging.warning('debug_2: {}'.format(compression_only))
266267
df.to_csv(f, compression=compression_only)

0 commit comments

Comments
 (0)