Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 23 24 [25] 26 27 ... 91

Author Topic: Programming Help Thread (For Dummies)  (Read 100666 times)

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #360 on: December 15, 2011, 08:26:40 pm »

C# -> Python question here.

Code: [Select]
Process yo = Process.Start(@"C:\Python25\python.exe", IO.Local + "\\dicelog.py");Process is System.Diagnostics.Process, and IO.Local is the stored value of the local directory that the program is housed within.

What I am doing: opening python.exe, and throwing it the address of a python program. Which I want it to run. dicelog.py outputs to a text file in the local directory. When checked, the output text file is unchanged after being supposedly worked on by dicelog.py.

Now, I've already tested dicelog.py, and it works. I've tested activating python.exe from this Start() method, and that also works. I can only assume that I am throwing an improper argument at it. The problem is that I've read the documentation, and I still can't understand what I'm doing wrong in my argument that I'm throwing to it. Throwing the file address as the only thing in the argument is supposed to work, isn't it?
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #361 on: December 15, 2011, 09:43:18 pm »

C# -> Python question here.

Code: [Select]
Process yo = Process.Start(@"C:\Python25\python.exe", IO.Local + "\\dicelog.py");Process is System.Diagnostics.Process, and IO.Local is the stored value of the local directory that the program is housed within.

What I am doing: opening python.exe, and throwing it the address of a python program. Which I want it to run. dicelog.py outputs to a text file in the local directory. When checked, the output text file is unchanged after being supposedly worked on by dicelog.py.

Now, I've already tested dicelog.py, and it works. I've tested activating python.exe from this Start() method, and that also works. I can only assume that I am throwing an improper argument at it. The problem is that I've read the documentation, and I still can't understand what I'm doing wrong in my argument that I'm throwing to it. Throwing the file address as the only thing in the argument is supposed to work, isn't it?

Have you checked the working directory of the C# program?
Logged

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #362 on: December 15, 2011, 10:00:49 pm »

Everything is nicely nestled inside of the same directory except for python.exe, but that is definitely a concern that should be checked, yes.

Your post also prompted me to check and see if the python file's text file reference was directing properly, and it is doing so as well.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

eerr

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #363 on: December 15, 2011, 10:03:40 pm »

C# -> Python question here.

Code: [Select]
Process yo = Process.Start(@"C:\Python25\python.exe", IO.Local + "\\dicelog.py");Process is System.Diagnostics.Process, and IO.Local is the stored value of the local directory that the program is housed within.

What I am doing: opening python.exe, and throwing it the address of a python program. Which I want it to run. dicelog.py outputs to a text file in the local directory. When checked, the output text file is unchanged after being supposedly worked on by dicelog.py.

Now, I've already tested dicelog.py, and it works. I've tested activating python.exe from this Start() method, and that also works. I can only assume that I am throwing an improper argument at it. The problem is that I've read the documentation, and I still can't understand what I'm doing wrong in my argument that I'm throwing to it. Throwing the file address as the only thing in the argument is supposed to work, isn't it?
http://docs.python.org/dev/library/multiprocessing
Is this a good example of throwing arguements or whatnot?
Logged

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #364 on: December 15, 2011, 10:15:58 pm »

That is one example. The one I'm using directly is this: http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx

What I'm really not sure about is what python.exe is doing with this once it gets it. It's not giving me any debug information, so I'm not sure what's going on once it gets to that point. The dialog of python.exe opens and shuts before I can even read it.

EDIT

I FIXED IT

It involved changing the file to .pyw, and not trying to run it through python.exe at all.
« Last Edit: December 15, 2011, 11:07:17 pm by Willfor »
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #365 on: January 14, 2012, 02:14:40 pm »

How do I write a new line in a file?

So with
Code: [Select]
infile.write(?)
what would I type for ?
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #366 on: January 14, 2012, 02:59:59 pm »

How do I write a new line in a file?

So with
Code: [Select]
infile.write(?)
what would I type for ?

Language? Some have writeline methods, some you would write a newline character, some handle it differently.
Logged

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #367 on: January 14, 2012, 03:03:15 pm »

Oops, I forgot to say its in Python.
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Xegeth

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #368 on: January 14, 2012, 03:03:44 pm »

Try this code:
Code: [Select]
infile.write('\n')
Logged

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #369 on: January 15, 2012, 06:10:16 pm »

Well, I'm trying to teach myself Java now, from Head First Java. However, an exercise taken out of the book does not seem to work.

Spoiler (click to show/hide)
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #370 on: January 15, 2012, 11:18:14 pm »

Well, I'm trying to teach myself Java now, from Head First Java. However, an exercise taken out of the book does not seem to work.

Spoiler: code (click to show/hide)

Works fine here. Are you getting any output?
Logged

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #371 on: January 16, 2012, 12:46:29 pm »

Sort of. the JFrame appears, with the button, but when clicked, no oval appears the first time or changes color.
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Help Thread (For Dummies)
« Reply #372 on: January 16, 2012, 07:52:43 pm »

Quote
Code: [Select]
painComponent

Just a guess, but that looks like either a mistake in the code, or a mistake in posting it, as it probably should be paintComponent.
Logged
Eh?
Eh!

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #373 on: January 16, 2012, 09:01:08 pm »

Either that or he's programming a torture simulator.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #374 on: January 16, 2012, 09:02:27 pm »

Either that or he's programming a torture simulator.

I really, really want this to end up being the case. That would be hilarious.
Pages: 1 ... 23 24 [25] 26 27 ... 91