Pickchip
Posts: 6
Joined: Mon Jul 29, 2013 2:06 pm
Location: Bath

Geany error

Mon Jul 29, 2013 7:14 pm

When I use IDLE my programmes run fine but running them from Geany always gives the error "can't find 'Main'. This happens even if II write the programme in Geany. Driving me crazy, help much appreciated

Thanks Pickchip

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Geany error

Mon Jul 29, 2013 8:01 pm

If I use NEW to get a new blank document in Geany, enter print("Hello DJ"), do SAVE_AS test.py, then run it by using the 'Gears' icon, I get a text box containing the printed message. Does that work for you?

What Operating System is running on your RPi? How did you install Geany? Do you have a very small sample program to demonstrate this failure?

(I am assuming your source code is in python, but maybe it's C? In that case my little test above is not helpful. Based on seeing IDLE used for python development - does it do other languages too?)
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Pickchip
Posts: 6
Joined: Mon Jul 29, 2013 2:06 pm
Location: Bath

Re: Geany error

Mon Jul 29, 2013 9:33 pm

Thank you

I tried your suggestion and ended up with the same error:
/usr/bin/python: can't find '_main_' module in ' home/pi/python'

Program exited with code:1

I am using Python and installed Geany from LXT terminal using; sudo apt-get install Geany

The short program works fine using IDLE

All my saved program's act the same when using Geany as the editor

Pickchip
Posts: 6
Joined: Mon Jul 29, 2013 2:06 pm
Location: Bath

Re: Geany error

Mon Jul 29, 2013 9:37 pm

By the way the operating system is Raspbian

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Geany error

Tue Jul 30, 2013 9:50 am

Frankly, I have no idea! Nor do I have any great knowledge of geany - I've installed it in the past to help others who were having trouble using it.

But I like a challenge...

The one-liner print("some string") is complete in itself - I don't see why geany needs to go off to try to find code for _main_

Could you post your version of my test.py one-line program here? [perhaps cat test.py, then use cut and paste to put it into a 'Code' block here, using the Code button at the top of the message editor screen.]

Can you get a screen shot of how it looks in geany on your system?

And if anyone else knows the answer to this - please chip in...
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
Davespice
Forum Moderator
Forum Moderator
Posts: 1665
Joined: Fri Oct 14, 2011 8:06 pm
Location: The Netherlands
Contact: Twitter

Re: Geany error

Tue Jul 30, 2013 10:02 am

This is might be because you've started a new file by going File > New With Template > main.py
In Geany; try removing everything in the file except for the very first line that says something like #!/user/bin/python
Then just put a line saying

Code: Select all

print "hello world"
And click the cogs to see if it will run.

Pickchip
Posts: 6
Joined: Mon Jul 29, 2013 2:06 pm
Location: Bath

Re: Geany error

Tue Jul 30, 2013 5:07 pm

Sorry', exactly the same error, usr.bin/python: can't find _main_ module in 'home/pi/python.

Pickchip
Posts: 6
Joined: Mon Jul 29, 2013 2:06 pm
Location: Bath

Re: Geany error

Wed Jul 31, 2013 7:37 am

SORTED! well in a radical way. I reformatted my SD card, and downloaded Raspbian again, did all the complicated stuff and configured the card. Once everything was working, installed Geany, wrote a simple programme and it returned " hello" with no error. This fails to explain while my original installation failed. Thank you everyone for your interest and help

Pickchip

Return to “Troubleshooting”