You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an error when trying to convert a single file into a full Django project.
If I have import urllib.parse code in my app.py file, command nanodjango convert app.py src --name=demo will result in an error:
Traceback (most recent call last):
File "demo_path/venv/bin/nanodjango", line 8, in <module>
sys.exit(invoke())
^^^^^^^^
…
File "demo_path/venv/lib/python3.12/site-packages/nanodjango/app.py", line 471, in convert
converter.build()
File "demo_path/venv/lib/python3.12/site-packages/nanodjango/convert/converter.py", line 271, in build
self.build_app_unused()
File "demo_path/venv/lib/python3.12/site-packages/nanodjango/convert/converter.py", line 746, in build_app_unused
obj_src, references = self.collect_definition(obj_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "demo_path/venv/lib/python3.12/site-packages/nanodjango/convert/converter.py", line 209, in collect_definition
obj_src = inspect.getsource(obj)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/inspect.py", line 1278, in getsource
lines, lnum = getsourcelines(object)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/inspect.py", line 1260, in getsourcelines
lines, lnum = findsource(object)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/inspect.py", line 1089, in findsource
raise OSError('could not get source code')
OSError: could not get source code
If I replace import urllib.parse with from urllib import parse, the conversion works.
Ubuntu 24.04.1 LTS
Python 3.12.3
The text was updated successfully, but these errors were encountered:
Thanks for this great project!
I ran into an error when trying to convert a single file into a full Django project.
If I have
import urllib.parse
code in myapp.py
file, commandnanodjango convert app.py src --name=demo
will result in an error:If I replace
import urllib.parse
withfrom urllib import parse
, the conversion works.The text was updated successfully, but these errors were encountered: