LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-28-2012, 11:49 PM   #1
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653
geany and python - indent problems


Geany 1.22
Python 2.7.3

Ive set the preferences in Geany editor to make tabs into 8 spaces, as many many many sites suggest to do. (Preferences -> editor -> indentation -> [Type = Spaces] [Width = 8])

However, when I try to compile some code, I get indentation errors.

What I dont understand is why Geany seems to be putting in tabs instead of spaces ..

Code:
print "hello"
        print "hello2"
Code:
Sorry: IndentationError: ('unexpected indent', ('pythontest.py', 2, 8, '    print "hello2"\n'))
So,.. has anyone gotten Geany to work with Python? And if so, how?
 
Old 08-29-2012, 09:52 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Linux Mint
Posts: 1,715

Rep: Reputation: 400Reputation: 400Reputation: 400Reputation: 400Reputation: 400
Works fine for me. On the Edit->Preferences->Editor->Indentation page, I use
"Type: Spaces" and set "Tab key indents"
 
1 members found this post helpful.
Old 08-29-2012, 10:04 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Original Poster
Rep: Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653
So... here is my configuration, which matches yours. And here is my error, which only I seem to get.
Attached Thumbnails
Click image for larger version

Name:	Preferences_001.jpeg
Views:	774
Size:	30.1 KB
ID:	10497   Click image for larger version

Name:	sometest.py - -home-gravitys_rainbow-Dropbox-programming - Geany_001.png
Views:	473
Size:	36.1 KB
ID:	10498  

Last edited by szboardstretcher; 08-29-2012 at 10:30 AM.
 
Old 08-29-2012, 01:16 PM   #4
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Linux Mint
Posts: 1,715

Rep: Reputation: 400Reputation: 400Reputation: 400Reputation: 400Reputation: 400
Problem with your code is that the second line should not be indented; it's not within a new block.
Code:
print "test"
print "test2"
works for me as does
Code:
print "test"
if 1==1:
  print "test2"
 
1 members found this post helpful.
Old 08-31-2012, 11:22 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Original Poster
Rep: Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653Reputation: 1653
Quote:
Originally Posted by RockDoctor View Post
Problem with your code is that the second line should not be indented; it's not within a new block.
Thanks! That was the issue. I'm new to Python and was unaware of how it treated formatting. I'm so used to C++ and being able to format how I like.

Help Appreciated.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems linking object files with geany on ubuntu scratchmonkey Programming 8 03-10-2009 11:09 PM
Vim re indent? dlublink Linux - Software 3 10-02-2006 02:37 PM
indent phoenix7 Linux - Software 6 08-30-2005 01:14 PM
no indent jesus_edu Linux - Newbie 0 04-13-2004 11:45 AM
indent chrismiceli Linux - General 1 05-12-2003 08:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration