Skip to content

Commit a7f74ba

Browse files
Make path and encoding not required (e.g. if using setPlainText instead of file.open)
1 parent 2578bed commit a7f74ba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pyqode/python/backend/workers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
import logging
77
import os
8+
import tempfile
89
import jedi
910

1011

@@ -238,7 +239,11 @@ def run_frosted(request_data):
238239
code = request_data['code']
239240
path = request_data['path']
240241
encoding = request_data['encoding']
241-
if not code or not encoding or not path:
242+
if not encoding:
243+
encoding = 'utf-8'
244+
if not path:
245+
path = os.path.join(tempfile.gettempdir(), 'temp.py')
246+
if not code:
242247
return []
243248
else:
244249
# First, compile into an AST and handle syntax errors.

0 commit comments

Comments
 (0)