Getting Eclipse / Pydev running

1,594 views
Skip to first unread message

pabloest

unread,
Jul 29, 2010, 9:38:11 AM7/29/10
to web2py-users
Hi,

I'm having some trouble simply getting started with Eclipse and Pydev
for web2py development.
I can't get into a debugging mode with web2py.py and the web server
will not even start. When I right-click and select Debug As > Python
Run, I get error messages that say:
-unexpected error setting up the debugger: socket closed
-pydev debugger: starting
Could not connect to localhost: 51530
Traceback (most recent call last):
File "/Applications/eclipse/plugins/
org.python.pydev.debug_1.6.0.2010071813/pysrc/pydevd_comm.py", line
341, in StartClient
s.connect((host, port))
File "<string>", line 1, in connect
gaierror: (8, 'nodename nor servname provided, or not known')

I haven't modified my db.py files from the default.
It seems I am missing something quite basic as I haven't found
anything on this message board or others to indicate this is a normal
problem.

I'm running Eclipse IDE for Javascript Developers (by the way, does it
matter which Eclipse? I also tried with Eclipse Classic and got the
same results).
Eclipse v1.3.0.2
Eclipse Platform SDK v3.0.6
PyDev for Eclipse 1.6.0.2
PyDev Mylyn Integration 0.3.0

I'm on a Mac 10.5.8 and Python 2.6.5.
Any hints?
Thanks much.

Bruno Rocha

unread,
Jul 29, 2010, 12:54:43 PM7/29/10
to web...@googlegroups.com

did you provide password parameter to run web2py.py?


2010/7/29 pabloest <pab...@gmail.com>



--

http://rochacbruno.com.br

pabloest

unread,
Jul 29, 2010, 1:26:14 PM7/29/10
to web2py-users
thanks.
normally I do, but I'm not sure where to do so in Eclipse. Similarly
with the port and address (127.0.0.1). I checked the debug config
parameters and variables and tried a bit there, but it didn't lead
anywhere.

Christopher Steel

unread,
Jul 29, 2010, 4:58:40 PM7/29/10
to web2py-users
Hi Pabloest,

We have started a Wiki with Web2py Eclipse and Maven Stuff where we
publish working configurations. It may be helpful. If you want to
contribute any additional info let me know.

http://code.google.com/p/voa-web2py2eclipse/

Cheer,

Christopher Steel

Voice of Access

http://code.google.com/p/voa-web2py2eclipse/

pabloest

unread,
Jul 29, 2010, 5:08:27 PM7/29/10
to web2py-users
Thanks, Christopher.

At some point it may make sense for me to contribute my learnings to
the wiki. However, for now I'm just trying to get off the ground so I
can't provide much value.

pabloest

unread,
Jul 31, 2010, 12:18:47 AM7/31/10
to web2py-users
well, I guess I will go with Wing, as it seems something is wrong with
my method or setup...

pablo

Rob

unread,
Jul 31, 2010, 12:47:50 AM7/31/10
to web2py-users
I have no issues with eclipse/pydev - sounds like from your initial
message that maybe your eclipse/pydev install is broken - maybe try to
redownload?

Do you have something else running on that port?

netstat -atun | grep 51530

Good luck!

pabloest

unread,
Jul 31, 2010, 1:05:32 PM7/31/10
to web2py-users
Thanks, Rob.

That's what I figured. I tried downloading and reinstalling, forcing
the interpreter to be python 2.5 and 2.4, but no luck.
The netstat command didn't reveal anything, but thanks for the tip.

One final thing: does it matter which flavor of Eclipse is used? I
have tried the javascript and classic bundles. I assume at least the
classic should be ok.

Pablo

Thadeus Burgess

unread,
Jul 31, 2010, 2:48:47 PM7/31/10
to web...@googlegroups.com
Something wrong with your setup, probably due to the fact your on a
Mac, they are not the friendliest for python development.

Have you tried installing the official python .dmg from python.org?


--
Thadeus

pabloest

unread,
Jul 31, 2010, 3:42:00 PM7/31/10
to web2py-users
Hi Thadeus,

Yes, I tried that also. Same result.

Pablo

Thadeus Burgess

unread,
Jul 31, 2010, 6:11:27 PM7/31/10
to web...@googlegroups.com
Odd. I am using eclipse classic with pydev on ubuntu. Debug works fine
for me. There is something wrong with the installation paths.

I'm thinking that now you have so many different versions of python on
your mac that it is causing even more issues =/
--
Thadeus

Miguel Lopes

unread,
Aug 1, 2010, 5:19:09 AM8/1/10
to web...@googlegroups.com
On Thu, Jul 29, 2010 at 2:38 PM, pabloest <pab...@gmail.com> wrote:
Hi,

I'm having some trouble simply getting started with Eclipse and Pydev
for web2py development.
I can't get into a debugging mode with web2py.py and the web server
will not even start. When I right-click and select Debug As > Python
Run, I get error messages that say:
-unexpected error setting up the debugger: socket closed

Try a different port. I use Aptana (eclipse based) + PyDev. It seems that eclipse is occupying the 8000 port, so web2py won't start. Just change the defaualt web2py port to something like 8080. It should be fine.

HTH,
Miguel

pabloest

unread,
Aug 1, 2010, 12:41:10 AM8/1/10
to web2py-users
Yes, that might well be it. I'm not sure the best way to "clean"
everything, or if I really want to as Wing is working fine....

Pablo

Christopher Steel

unread,
Aug 1, 2010, 12:09:20 PM8/1/10
to web2py-users
I took a closer look at your error message. Make sure the web2py and
Eclipse are not trying to serve on the same ports. You might try
running Web2py on port 8080 from Eclipse...

;)

Chris

pabloest

unread,
Aug 2, 2010, 1:04:49 AM8/2/10
to web2py-users
Thanks, Christopher and Miguel.

I will try a different port.
Actually on Wing I started to get a similar error about nothing
listening (and then an exit). But this was after the web2py pop-up
where I can enter the port.
I had just read your replies so I tried port 8080 and that did it.
Thank you!

I tried again on Eclipse but it won't even get to the point of
bringing up the web2py window where I can set the port.

I will try Aptana - I believe I already downloaded it.

Pablo

Miguel Lopes

unread,
Aug 2, 2010, 8:54:25 AM8/2/10
to web...@googlegroups.com
Here's my naif setup - note that this should be exactly the same for Eclipse or Aptana (Aptana is Eclipse + goodies):

1. Use web2py source.
2. Make sure you have PyDev installed in Eclipse/Aptana.
3. Create a project a PyDev project:
  * this will link to the web2py folder on the file system - so you will have access to all projects and the web2py installation
  * I call this project "web2py_projects"
  * (if you know what a perspective is in Eclipse, you can use either Aptana or PyDev perspectives - it's irrelevant).
4. Create a link to the web2py folder in the project: just create a folder and use the "Advanced >>" button to link to the web2py folder in the file system

Know you are ready to go!
In general I either duplicate an existing project directly from the file view in the IDE or I use the web2py web interface to do it.
Note that if you change any web2py files from outside of Eclipse, then you will have to refresh the project so that the file structure is re-read. This can be done by selecting the project in the File View and pressing F5.

Debugging with PyDev:
Since we are in development I always run web2py in PyDev's debugging mode
1. Run we2py regularly, set an admin password and stop the server. This is just so you have a password set in web2py for admin access
2. Open the web2py.py file
3. Select Debug | Debug configurations - under "Python Run" create a new configuration, name it: "Run web2py" (or something useful):
   * In the Main tab: select the web2py_projects as the "Project" and select the web2py.py file as the "Main Module"
   * Click "Apply"
   * In the "Arguments" tab type (without the curly braces):  {-p 8080 -a "<recycle>"}  this will avoid the dialog for starting web2py and will run on port 8080 with the last password used (you must have set an admin password previously)
   * Some of the other tabs may be useful, e.g. setting the interpreter
4. When ready click "Debug", and presto web2py is running in PyDev's debug mode
5. When you wish to debug some code just double click, or "right-click" on the code editors left margin to set break points. PyDev will automatically launch the debug perspective.

BTW If you search you can find some info on getting code completion to work (I have not yet bothered).

HTH,
Miguel

pabloest

unread,
Aug 2, 2010, 9:41:14 PM8/2/10
to web2py-users
Thank you for the extended description.
This is almost exactly what I had been following. I had skipped the
arguments partially because I think Eclipse is not taking them. When I
enter the arguments and then go to the interpreter tab to "see
resulting command line for the given parameters" (button), they do not
appear. Other commands do appear, but not what I've entered into the
arguments tab. Do yours appear there?

Aptana gave the same behavior as Eclipse, but I'm not surprised.

I might try re-downloading web2py's source - perhaps something got
corrupted.

Pablo

Phyo Arkar

unread,
Aug 3, 2010, 5:33:48 AM8/3/10
to web...@googlegroups.com
Import web2py directly from mercurial repo.

For me , THis work flawlessly 


all completions , debugging works. just paste your application inside it .

Miguel Lopes

unread,
Aug 3, 2010, 6:55:56 AM8/3/10
to web...@googlegroups.com
On Tue, Aug 3, 2010 at 2:41 AM, pabloest <pab...@gmail.com> wrote:
Thank you for the extended description.
This is almost exactly what I had been following.
 
You welcome. Interesting to know you came up with a similar solution.
 
I had skipped the
arguments partially because I think Eclipse is not taking them. When I
enter the arguments and then go to the interpreter tab to "see
resulting command line for the given parameters" (button), they do not
appear. Other commands do appear, but not what I've entered into the
arguments tab.  Do yours appear there?

Arguments do not appear in the interpreter tab, but they are applied. I you enter something like   -p 8080 -a "<recycle>"   in the arguments tab when you run web2py.py the startup dialog box should not appear. Give it a try. I find it very convenient not to have the pesky dialog.
 

Aptana gave the same behavior as Eclipse, but I'm not surprised.

I might try re-downloading web2py's source - perhaps something got
corrupted.
 
I wouldn't expect this to be related to web2py. 

Pablo


Reply all
Reply to author
Forward
0 new messages