Aptana update breaks Django debugging - django

I set up my Aptana Studio 3 / PyDev debugger according to the instructions and even got to the point where everything worked, including breakpoints and auto-reload. Loved it. Now, as of an update last Saturday, the debugger doesn't work any more.
I noticed that the
Aptana Studio 3/plugins/org.python.pydev.debug_x.x/pysrc
folder has gone missing. I found another pysrc folder in
Aptana Studio 3/plugins/org.python.pydev_x.x
which seems to contain the required pydevd module, together with the patch_django_autoreload() function and all. But if I put it on the Python path, I just get an ugly stack trace, ending in
OSError: [Errno 2] No such file or directory
Any ideas what's gone wrong here? Using Aptana Studio 3.2.0.201206251729, Django 1.3.1, Python 2.7.1 on OS X 10.7.4.
EDIT The full traceback:
Executing process on new console: /usr/bin/python /Users/timo/Documents/aptana-studio-3-workspace/ssm/ssd/manage.py runserver 0.0.0.0:8000
Warning: to actually kill the created console, the parent process (in Eclipse console) must be killed first.
Traceback (most recent call last):
File "/Users/timo/Documents/aptana-studio-3-workspace/ssm/ssd/manage.py", line 22, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
self.run(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 76, in run
autoreload.main(self.inner_run, args, options)
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062121/pysrc/pydevd.py", line 1175, in main
return original_main(main_func, args, kwargs)
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 138, in main
reloader(main_func, args, kwargs)
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 116, in python_reloader
sys.exit(restart_with_reloader())
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062121/pysrc/pydevd.py", line 1212, in restart_with_reloader
popen = subprocess.Popen(args, env=new_environ)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
EDIT 2 Some more debug info, as requested:
args: ['xterm', '-e', '/usr/bin/python', '/Users/timo/Documents/aptana-studio-3-workspace/ssm/ssd/manage.py', 'runserver', '0.0.0.0:8000']
new_environ: {'PYTHONIOENCODING': 'UTF-8', 'RUN_MAIN': 'true', 'VERSIONER_PYTHON_PREFER_32_BIT': 'no', 'LOGNAME': 'timo', 'USER': 'timo', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'HOME': '/Users/timo', 'DISPLAY': '/tmp/launch-Hsa1eC/org.x:0', 'SHELL': '/bin/bash', 'TZ': 'Europe/Vienna', 'VERSIONER_PYTHON_VERSION': '2.7', 'SECURITYSESSIONID': '186a5', 'GL_ENABLE_DEBUG_ATTACH': 'YES', 'PYDEV_CONSOLE_ENCODING': 'UTF-8', 'com.apple.java.jvmTask': 'JNI', 'PYTHONPATH': '/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062121/pysrc/pydev_sitecustomize:/Users/timo/Documents/aptana-studio-3-workspace/ssm/ssd:/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062121/pysrc:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC:/Library/Python/2.7/site-packages:/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.4.0.2012020116/pysrc', 'SSH_AUTH_SOCK': '/tmp/launch-ILkkCc/Listeners', 'CELERY_LOADER': 'djcelery.loaders.DjangoLoader', 'Apple_PubSub_Socket_Render': '/tmp/launch-GuOmAI/Render', 'TMPDIR': '/var/folders/yw/7q8d2tzj70q1yqwwqhgkqsw00000gn/T/', 'APP_ICON_844': '../Resources/aptana.icns', 'PYDEV_COMPLETER_PYTHONPATH': '/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062121/pysrc', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'Apple_Ubiquity_Message': '/tmp/launch-lxY2Pu/Apple_Ubiquity_Message', 'DJANGO_SETTINGS_MODULE': 'ssd.settings', 'COMMAND_MODE': 'unix2003'}
There's two things to note here. 1) I tried to check whether everything on the PYTHONPATH actually existed. This was mostly the case, except for /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip and /Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.4.0.2012020116/pysrc, which makes me wonder whether I just have to get Aptana to rescan the Python directories.
2) The Aptana application path contains spaces (by default). I've seen some rare cases where libraries of any kind still choke on that.

The org.python.pydev.debug/pysrc is really removed (and the correct one is really org.python.pydev/pysrc as you found out)... Will update the homepage to reflect that :)
So, with this it should be working... Now, as for your error, please post the complete error log (with just that part, it's hard to know what may be happening -- tested it here with that path and it does work properly).

not sure if related but I upgraded eclipse from 3.6 to 4.2 and Aptana from 2 to 3 with pydev
Now my debugger is not working. After upgrading eclipse, aptana, pydev, Debugger not working

I had this issue too and just upgraded to PyDev 3.4.1, which fixed things for me. Read through http://pydev.org/manual_adv_debug_console.html if you keep having issues.

Related

KivyMD on a Mac: running kitchen_sink raises an error in kivytoast.py

On a Macbook Pro (Catalina), Python 3.8, interested in developing Android apps in Kivy using KivyMD. I took the following steps to install KivyMD:
create the virtual environment (virtmd), then activated it (source /virtmd/bin/activate)
in this virtual environment, installed the following via pip: Pillow, kivy
git-cloned KivyMD as per the link suggested on the GitHub page
Ran the pip install .
All this ran seamlessly with no hitch or errors. pip freeze shows the following installed items:
certifi==2021.5.30
charset-normalizer==2.0.4
docutils==0.17.1
idna==3.2
Kivy==2.0.0
Kivy-Garden==0.1.4
kivymd # file:///Users/robinhahn/PyProg/kvKivyMD/KivyMD
Pillow==8.3.1
Pygments==2.9.0
requests==2.26.0
urllib3==1.26.6
I was following a Codemy video tutorial and noticed that the presenter's pip freeze showed 4 more entries:
chardet==4.0.0
kivy-deps.angle==0.3.0
kivy-deps.glew==0.3.0
kivy-deps.sdl2==0.3.1
Cd'ed into the /demos/kitchen_sink folder, ran 'python3 main.py' which failed, raising this error, the last few lines of the traceback appear to focus on a file called kivytoast.py:
File "main.py", line 144, in <module>
KitchenSinkApp().run()
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/app.py", line 949, in run
self._run_prepare()
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/app.py", line 944, in _run_prepare
self.dispatch('on_start')
File "_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "main.py", line 65, in on_start
Builder.load_file(
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/lang/builder.py", line 306, in load_file
return self.load_string(data, **kwargs)
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/lang/builder.py", line 373, in load_string
parser = Parser(content=string, filename=fn)
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/lang/parser.py", line 402, in __init__
self.parse(content)
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/lang/parser.py", line 508, in parse
self.execute_directives()
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivy/lang/parser.py", line 472, in execute_directives
mod = __import__(package)
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivymd/toast/__init__.py", line 11, in <module>
from .kivytoast import toast
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivymd/toast/kivytoast/__init__.py", line 3, in <module>
from .kivytoast import toast
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivymd/toast/kivytoast/kivytoast.py", line 72, in <module>
class Toast(BaseDialog):
File "/Users/robinhahn/PyProg/kvKivyMD/virtmd/lib/python3.8/site-packages/kivymd/toast/kivytoast/kivytoast.py", line 90, in Toast
self, instance_label: Label, texture_size: list[int, int]
TypeError: 'type' object is not subscriptable
Still somewhat of a novice, and not really sure how to proceed from here.
ETA: I brought this up in VSCode and the last word:
list[int, int]
was squiggly-underlined, indicating it's the offending item. I have no idea what 'type' object is not subscriptable means or how to fix it.
Thanks to all who read and ponder this problem.
I'm on the same course right now and just got to that file with the same issue. I followed the path to the 'kivytoast.py' file and changed the following line (line 89):
def label_check_texture_size(self, instance_label: Label, texture_size: list([int, int])) -> NoReturn:
The kivymd devs seemed to have made a mistake and did list[int, int] instead of list([int,int]). You could also just leave it as [int,int] and it would work the same since it is alread in list format. Goodluck with the rest of your course!

trying to use cookiecutter-django, getting errors and does not create anything

trying to get a Django project started using cookiecutter-django and can't seem to get it to generate anything.
using Python 3.6, Django 2.0.5, cookiecutter 1.6.0 (then created a virtualenv and entered a new, blank directory)
so I enter this command:
cookiecutter https://github.com/pydanny/cookiecutter-django
and get this error traceback:
Traceback (most recent call last):
File "c:\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Python\python36\Scripts\cookiecutter.exe\__main__.py", line 9, in
<module>
File "c:\python\python36\lib\site-packages\click\core.py", line 722, in
__call__
return self.main(*args, **kwargs)
File "c:\python\python36\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python\python36\lib\site-packages\click\core.py", line 895, in
invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python\python36\lib\site-packages\click\core.py", line 535, in
invoke
return callback(*args, **kwargs)
File "c:\python\python36\lib\site-packages\cookiecutter\cli.py", line 120,
in main
password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "c:\python\python36\lib\site-packages\cookiecutter\main.py", line 63,
in cookiecutter
password=password
File "c:\python\python36\lib\site-packages\cookiecutter\repository.py", line
103, in determine_repo_dir
no_input=no_input,
File "c:\python\python36\lib\site-packages\cookiecutter\vcs.py", line 99, in
clone
stderr=subprocess.STDOUT,
File "c:\python\python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "c:\python\python36\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone',
'https://github.com/pydanny/cookiecutter-django']' returned non-zero exit
status 128.
OK - figured out how to get this to work.
used Github desktop
from cookiecutter-django repository, right click
open it Git Shell
this opens a Powershell window.
CD to directory where project will be placed in.
cookiecutter https://github.com/pydanny/cookiecutter-django
and it works.
not sure exactly why this works when regular CMD and elevated CMD do not, but this was the only way I could get it to work.
This is a permission issue with github due to the need to setup ssh keys. By the way I'm using ubuntu 12.
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ - create a key first in your machine using the instructions in the link. Once you have your ssh key, proceed to step 2. (Step 2 is indicated in the first link as last step)
https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account - add the generated ssh key to your github account.

Error in runserver with Django on windows 10

I am using python 3.5 and windows 10, but had the same issue using windows 8, and that is the traceback i get while trying to runserver:
Traceback (most recent call last):
File "C:\Users\noabendor87\documents\otree\manage.py", line 10, in
execute_from_command_line(sys.argv, script_file=file)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\otree\management\cli.py", line
177, in execute_from_command_line
utility.execute()
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management__init__
.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\base.py"
, line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands
\runserver.py", line 49, in execute
super(Command, self).execute(*args, **options)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\base.py"
, line 445, in execute
output = self.handle(*args, **options)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands
\runserver.py", line 88, in handle
self.run(**options)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands
\runserver.py", line 97, in run
autoreload.main(self.inner_run, None, options)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li
ne 336, in main
reloader(wrapped_main_func, args, kwargs)
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li
ne 307, in python_reloader
exit_code = restart_with_reloader()
File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li
ne 293, in restart_with_reloader
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
I have already tried following the instructions in the following link:
http://stackoverflow.com/questions/25714826/error-in-manage-py-runserver-with-django-on-windows-8-1
but it did not help.
This is how the lines of code look like:
enter image description here
(Since Im a new user I cannot paste the image to the original post)
Anyone have encountered something similar and have a solution?
I used to have similar problems because of the difficulties with the virtual environment in windows 10. Try running the powershell as an administrator and do "Set-ExecutionPolicy RemoteSigned" or "Set-ExecutionPolicy Unrestricted" if remotesigned does not work. Do this before activating the virtualenv.
first I will like you check the django version you are working with my "type python -m django --version" or "pip freeze". check weather its compatible with the python version on your pc. if it's not install compatible python version. then check weather "init.py" is within your project directory, if not add it to your project directory. then run "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" on your terminal. then run activate your virtualenv, then run "python manage.py runserver"

py2app runs fine in alias mode but not when bundled tkinter

I am trying to bundle an app in my Mac OS X Snow Leopard 10.6.8. I've python2.7, py27-tkinter installed through macports 2.3.4.
My code runs perfect when run as a script as well as in py2app's alias mode. However, when I bundle it doesn't behave properly: meaning, upon every conditional check on the user input integer, the result should be updated in the window. However, the result is updated only for the first input integer and nothing gets updated for the subsequent inputs. When I try to run interactively, I get the following error:
Traceback (most recent call last):
File "setup.py", line 18, in
setup_requires=['py2app'],
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 659, in run
self._run()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 865, in _run
self.run_normal()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 939, in run_normal
mf = self.get_modulefinder()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 814, in get_modulefinder
debug=debug,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/modulegraph/find_modules.py", line 341, in find_modules
find_needed_modules(mf, scripts, includes, packages)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/modulegraph/find_modules.py", line 266, in find_needed_modules
path = m.packagepath[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
Could anyone shed some light on what is missing/wrong here and how to troubleshoot and ultimately solve the problem?
Many thanks in advance.

PyCharm manage.py runserver error

Sorry to ask a noob question but I have no idea why this is happening.
I've just reinstalled Django 1.3, and am trying PyCharm for the first time. When I run python manage.py runserver from Terminal everything goes without a hitch, however if I try to runserver from within PyCharm I get the following:
Importing Django settings module settings
Traceback (most recent call last):
Validating models...
0 errors found
Django version 1.3, using settings 'glist.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
File "/Applications/PyCharm 1.2.1.app/helpers/pycharm/django_manage.py", line 19, in <module>
run_module(manage_file, None, '__main__')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 180, in run_module
fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/goon/code/glist/manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
self.run(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 76, in run
autoreload.main(self.inner_run, args, options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py", line 131, in main
reloader(main_func, args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py", line 104, in python_reloader
reloader_thread()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py", line 83, in reloader_thread
ensure_echo_on()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py", line 77, in ensure_echo_on
attr_list = termios.tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')
Process finished with exit code 1
Please note that this is all happening before I request any page from within the browser. And, as I said, I have no trouble running from Terminal. Any help would be greatly appreciated.
What version fo pycharm are you using ? Actually it`s a error in django 1.3. It will occur if you try to run django from any ide in reload mode. It can be fixed by patching django. Although PyCharm should automatically switch to no reload mode.
Read this : http://blogs.jetbrains.com/pycharm/2011/03/pycharm-1-2-1-release-candidate-py-test-2-0-buildout-1-5/
Apply the patch. Its Django 1.3.1 error. This worked for me on pYCharm 3.4.1
https://github.com/django/django/commit/3e7ce3c750