Help with Python™

Discussion about hacker.org's server
Post Reply
User avatar
88EighT88
Posts: 13
Joined: Sun Nov 15, 2009 11:08 am

Help with Python™

Post by 88EighT88 »

Hi i just downloaded python and i have allready got some of the basic very easy language actually can some just tell me how i can debug and run the script?

Thanx
"A computer is considered a user
A series of computers is considered a network
The worlds computers are considered a PLayGround"
~88EighT88~
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

as far as debugging goes the only option I'm aware of is running the script through a console such (cmd.exe or command.com), then when any errors occur they are printed out in the console and do not disappear when the script terminates. If you're sticking to simple things you can use www.codepad.org to run your code and display the output (it doesn't support anything involving sockets and you cant use file I/O) which is really good for practising as you can do it anywhere, its quick and even has syntax highlighting. I think its using Python 2.6.4 (as its the standard on debian) which has slight differences to 3

p.s these colours are done with a python script :P
User avatar
88EighT88
Posts: 13
Joined: Sun Nov 15, 2009 11:08 am

Post by 88EighT88 »

Thanx for reply and do you think u could give me the script? :D
"A computer is considered a user
A series of computers is considered a network
The worlds computers are considered a PLayGround"
~88EighT88~
User avatar
88EighT88
Posts: 13
Joined: Sun Nov 15, 2009 11:08 am

Post by 88EighT88 »

Ok so i tried that Cmd.exe thing and its giving errors then i try Python Command line and its gives a syntax error no description just "There is a syntax error" any suggestions?

any specific Cmds i should be running other than open ("dir") (python comline) run dir (cmd)?

any extension i should be adding?
"A computer is considered a user
A series of computers is considered a network
The worlds computers are considered a PLayGround"
~88EighT88~
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

I would send you it but I'd much rather see you make your own, it's a good way to lean (plus it makes the posts ~40 times larger so I probably shouldn't promote this too much).

you can just do
python "Z:\my files\my folder\my script.py"
in the command line to save you the 'cd' hastle, and the syntax errors you just have to figure out yourself (might take a bit of time) which you simply do by reading through the code and checking things, it could be something like you have = instead of == or too much going on on a single line.
User avatar
PaRaDoX
Posts: 708
Joined: Fri Aug 22, 2008 5:52 am
Location: In your fridge, waiting to pop out and scare you.

Post by PaRaDoX »

Also, make sure you installed python correctly (changed certain environment variables / options, etc.)
Image

~You are a glitch in my reasoning.
User avatar
88EighT88
Posts: 13
Joined: Sun Nov 15, 2009 11:08 am

Post by 88EighT88 »

PaRaDoX wrote:Also, make sure you installed python correctly (changed certain environment variables / options, etc.)
Can you please tell me how to do this Paradx?

the cmd command isnt running it...
"A computer is considered a user
A series of computers is considered a network
The worlds computers are considered a PLayGround"
~88EighT88~
User avatar
PaRaDoX
Posts: 708
Joined: Fri Aug 22, 2008 5:52 am
Location: In your fridge, waiting to pop out and scare you.

Post by PaRaDoX »

88EighT88 wrote:
PaRaDoX wrote:Also, make sure you installed python correctly (changed certain environment variables / options, etc.)
Can you please tell me how to do this Paradx?

the cmd command isnt running it...
Depends what error you're getting. If its a syntax error, make sure you followed the instructions on the python site. Can't remember the exact thing it tells you to do, but I remember that it had something to do with the window where you change environment variables, this kinda thing that eliminated the need to go to the python directory, it made all the commands global.
Image

~You are a glitch in my reasoning.
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

you can add the python directory to the PATH variable so it searches that directory for executables, here's a link about adding to the PATH:
http://www.computerhope.com/issues/ch000549.htm
once that's done you can simply do this to start a python session (assuming the python executable is called python which is probably is):

Code: Select all

python "my file.py"
or if you just want to open an interactive session to play with:

Code: Select all

python
try not to mess up your path by replacing all the paths with a single new one (your PATH should be a semicolon separated list of paths and not just a single path)
User avatar
PaRaDoX
Posts: 708
Joined: Fri Aug 22, 2008 5:52 am
Location: In your fridge, waiting to pop out and scare you.

Post by PaRaDoX »

CodeX wrote:you can add the python directory to the PATH variable so it searches that directory for executables, here's a link about adding to the PATH:
http://www.computerhope.com/issues/ch000549.htm
once that's done you can simply do this to start a python session (assuming the python executable is called python which is probably is):

Code: Select all

python "my file.py"
or if you just want to open an interactive session to play with:

Code: Select all

python
try not to mess up your path by replacing all the paths with a single new one (your PATH should be a semicolon separated list of paths and not just a single path)

YEA! that was it :P


Thanks, that was bugging me for a while >.>
Image

~You are a glitch in my reasoning.
Liidian
Posts: 202
Joined: Fri Jun 05, 2009 10:49 pm
Location: Guess

Post by Liidian »

Or you could have used python GUI from the start >.>
The whole "system" is a number of people creating a code all together, this code loops and is there for a "system".
System Zero could also be confirmed with one word "Hacker's"
User avatar
88EighT88
Posts: 13
Joined: Sun Nov 15, 2009 11:08 am

Post by 88EighT88 »

THANX ALOT!!!
"A computer is considered a user
A series of computers is considered a network
The worlds computers are considered a PLayGround"
~88EighT88~
User avatar
PaRaDoX
Posts: 708
Joined: Fri Aug 22, 2008 5:52 am
Location: In your fridge, waiting to pop out and scare you.

Post by PaRaDoX »

Liidian wrote:Or you could have used python GUI from the start >.>
Meh, command line has a charm to it :3
Image

~You are a glitch in my reasoning.
Post Reply