Author Topic: VrrtepCLI  (Read 20944 times)

0 Members and 1 Guest are viewing this topic.

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #20 on: May 23, 2011, 01:29:03 am »
sourcecode website as posted in post 1 updated. Let the downloading and bug reporting begin. >:D

kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Sіr. Ηaxalot

  • Palulukan Makto
  • *****
  • Posts: 1307
  • Karma: 45
  • ¯\_(ツ)_/¯
Re: VrrtepCLI: Translator+
« Reply #21 on: May 23, 2011, 01:30:00 am »
May I suggest installing it in %APPDATA% or %PROGRAMFILES%, depending on if it's supposed to be visible to the user or not? I consider putting data/applications directly in the user directory as a bit of an ugly hack.

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #22 on: May 23, 2011, 01:31:54 am »
Perhaps in Windows it is. On linux apparently it is not uncommon for a program to make a hidden file in the home directory. Though I see your point. the convention for Windows is generally to install everything to \Program Files\

EDIT: Oh. yeah, the stuff in that file don't need to be visible to the user after installation. Perhaps some tweaks to the windows versions to install everything to %APPDATA% is in order.
« Last Edit: May 23, 2011, 01:35:17 am by Tirea Aean »

kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #23 on: May 23, 2011, 02:00:19 am »
Perhaps in Windows it is. On linux apparently it is not uncommon for a program to make a hidden file in the home directory. Though I see your point. the convention for Windows is generally to install everything to \Program Files\

EDIT: Oh. yeah, the stuff in that file don't need to be visible to the user after installation. Perhaps some tweaks to the windows versions to install everything to %APPDATA% is in order.
Well...I thought I was going to bed, but now I'm watching Mythbusters...

Anyway, the reason I originally put the app in %userprofile%\.vrrtepcli on Windows is because doing this means it works on both Linux and Windows without requiring any changes. Using different folders requires OS and folder detection code.

I'll look at it tomorrow.
« Last Edit: May 23, 2011, 02:05:28 am by Swoka Ikran »
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Sіr. Ηaxalot

  • Palulukan Makto
  • *****
  • Posts: 1307
  • Karma: 45
  • ¯\_(ツ)_/¯
Re: VrrtepCLI: Translator+
« Reply #24 on: May 23, 2011, 06:32:41 am »
Perhaps in Windows it is. On linux apparently it is not uncommon for a program to make a hidden file in the home directory. Though I see your point. the convention for Windows is generally to install everything to \Program Files\

EDIT: Oh. yeah, the stuff in that file don't need to be visible to the user after installation. Perhaps some tweaks to the windows versions to install everything to %APPDATA% is in order.
Well...I thought I was going to bed, but now I'm watching Mythbusters...

Anyway, the reason I originally put the app in %userprofile%\.vrrtepcli on Windows is because doing this means it works on both Linux and Windows without requiring any changes. Using different folders requires OS and folder detection code.

I'll look at it tomorrow.


The thing is that the dot doesn't hide the folder in Windows and I thought that since the use of %userprofile% only applies for the windows version anyway, it wouldn't be much of a problem to change?

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #25 on: May 23, 2011, 01:37:56 pm »
The thing is that the dot doesn't hide the folder in Windows and I thought that since the use of %userprofile% only applies for the windows version anyway, it wouldn't be much of a problem to change?
VrrtepCLI references its resource files by absolute path right now:
os.path.expanduser('~')+"/.vrrtepcli/metaWords.txt"

I've found a way to make it not care about location: os.path.expanduser() could possibly be replaced with sys.path[0], but I need someone on Linux to verify sys.path[0] works (because some places say yes, others say no).

Can someone run this on Linux or Mac please? I need to see if sys.path[0] works on it. Copy and save it as a .py (anywhere you like), then run from terminal.
Code: [Select]
#!/usr/bin/python
import sys
print sys.path[0]
You should get the folder where the script is located as the output. If you don't...not good.

Also, just as an aside: A lot of other cross-platform programs also use %userprofile%\.appname folders for data on Windows, so, IMO, using %userprofile%\.vrrtepcli isn't that big of a deal.
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #26 on: May 23, 2011, 02:07:36 pm »
sys.path[0] on linux is the empty string.


kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #27 on: May 23, 2011, 02:13:25 pm »
sys.path[0] on linux is the empty string.


You ran Python interactively...it's supposed to be empty in that case. It is on Windows too.

Can you save the print command to a .py then run it from the command line (e.g. python test.py), rutxe?
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #28 on: May 23, 2011, 02:24:47 pm »
oh right. should have seen that coming. /me facepalms

[email protected]:~$ ./test.py
/home/tirea


it works.


« Last Edit: May 23, 2011, 02:27:40 pm by Tirea Aean »

kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #29 on: May 23, 2011, 02:46:02 pm »
oh right. should have seen that coming. /me facepalms

[email protected]:~$ ./test.py
/home/tirea


it works.
Cool. I'll go through the app and make the change...

Do you want me to modify the Windows install script to put it in %Appdata%? Only difference will be that users will need to type: cd "%appdata%\.vrrtepcli" instead of the current cd "%userprofile%\.vrrtepcli" when they open CMD.
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #30 on: May 23, 2011, 02:53:19 pm »
is there a way so that all they have to do is open cmd and use it?

(like you can on linux because the install script makes an alias)

kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Kä'eng

  • Uniltìranyu
  • **
  • Posts: 133
  • Karma: 12
Re: VrrtepCLI: Translator+
« Reply #31 on: May 23, 2011, 02:59:34 pm »
Instead of requiring installation into some specific directory, how about using python's __file__ variable (gives the path to the current script) so the user can just unzip the program wherever he/she wants?

(Note that installing in "%USERPROFILE%" or "%APPDATA%" is a common thing for Windows malware to do when it has not obtained administrator access yet, so doing so may trigger false positives from antivirus software)
Ma evi, ke'u ke lu prrte' to fwa sim tuteot ayawne.
Slä txo tuteo fmi 'ivampi ngat ro seng, fu nìfya'o, a 'eykefu ngati vä', tsakem ke lu sìltsan.
Tsaw lu ngeyä tokx! Kawtu ke tsun nìmuiä 'ivampi ngat txo ngal ke new tsakemit.
Ha kempe si nga? Nì'awve, nga plltxe san kehe. Tsakrr, ngal tsatsengti hum!

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #32 on: May 23, 2011, 03:22:56 pm »
is there a way so that all they have to do is open cmd and use it?

(like you can on linux because the install script makes an alias)
Put it in your path. Same procedure as you did with Python, but put the vrrtepCLI folder instead of the Python folder. Aliases don't exist on Windows.

I made the sys.path[0] change...it works if I use the .py version, but is incompatible with py2exe, so if we keep this change, we can't have an EXE version :( What do we want to do about this?

Instead of requiring installation into some specific directory, how about using python's __file__ variable (gives the path to the current script) so the user can just unzip the program wherever he/she wants?

(Note that installing in "%USERPROFILE%" or "%APPDATA%" is a common thing for Windows malware to do when it has not obtained administrator access yet, so doing so may trigger false positives from antivirus software)
__file__ won't work. :( That was the first thing I tried. I need an absolute path to the script folder, not a relative path to the script itself (which is what __FILE__ gives on Windows). Sys.path[0] does exactly what I need, but doesn't work if the program is compiled.

Also, the malware thing...non-issue. Google Chrome, Minecraft, and Virtual Box (3 big name programs), all install to %APPDATA% and %USERPROFILE%. GIMP keeps a couple things in there as well...
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Sіr. Ηaxalot

  • Palulukan Makto
  • *****
  • Posts: 1307
  • Karma: 45
  • ¯\_(ツ)_/¯
Re: VrrtepCLI: Translator+
« Reply #33 on: May 23, 2011, 03:27:10 pm »
is there a way so that all they have to do is open cmd and use it?

(like you can on linux because the install script makes an alias)

The best way would ba changing the PATH variable to include the application directory. Or the mory ugly way; putting binaries in C:\Windows\system32

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #34 on: May 23, 2011, 03:31:19 pm »
is there a way so that all they have to do is open cmd and use it?

(like you can on linux because the install script makes an alias)

The best way would ba changing the PATH variable to include the application directory.
Not easily doable in a batch script. If I do: set PATH=%path%;%userprofile%\.vrrtepcli it's only good until the batch script ends. You have to edit the registry or change it in System Properties if you want to make it permanent.

Or the mory ugly way; putting binaries in C:\Windows\system32
That's one way to do it...
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Tirea Aean

  • The Blue One
  • Olo'eyktan Anawm
  • Palulukan Makto
  • *****
  • *
  • *
  • *
  • Posts: 9891
  • nv Eywa'eveng
  • Karma: 243
  • Oeri ran lu srung
    • Tirea Aean
Re: VrrtepCLI: Translator+
« Reply #35 on: May 23, 2011, 03:53:57 pm »
my only concern is, not every windows user is tech-savvy. The easiest way possible for the end user is my goal.

kelku ikranä a hawnventi yom podcast (na'vi-only): https://tirearadio.com/podcast
Learn Na'vi Discord Chat: https://discord.gg/WF6qcmv

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #36 on: May 23, 2011, 04:12:14 pm »
my only concern is, not every windows user is tech-savvy. The easiest way possible for the end user is my goal.
The system32 method is easiest then.

As for the sys.path[0] and putting it in %appdata% thing, I'm just going to forget it since Py2EXE isn't compatible with it. IMO, having a standalone EXE version is far more important to users than being able to move the .py version around.

I'll add the path support so you can use it by just opening CMD and typing vrrtepcli :)
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Kä'eng

  • Uniltìranyu
  • **
  • Posts: 133
  • Karma: 12
Re: VrrtepCLI: Translator+
« Reply #37 on: May 23, 2011, 04:20:58 pm »
Instead of requiring installation into some specific directory, how about using python's __file__ variable (gives the path to the current script) so the user can just unzip the program wherever he/she wants?
__file__ won't work. :( That was the first thing I tried. I need an absolute path to the script folder, not a relative path to the script itself (which is what __FILE__ gives on Windows). Sys.path[0] does exactly what I need, but doesn't work if the program is compiled.
It works for me to just replace all instances of
os.path.expanduser('~')+"/.vrrtepcli/<filename>"
with
os.path.join(os.path.dirname(__file__), "<filename>")

Edit:
my only concern is, not every windows user is tech-savvy. The easiest way possible for the end user is my goal.
I'd say the easiest way for the end user is that they can just double-click the .exe/.cmd/.py/whatever (or create a shortcut to it on their desktop :)), and not have to open a command prompt at all.
« Last Edit: May 23, 2011, 04:28:37 pm by Kä'eng »
Ma evi, ke'u ke lu prrte' to fwa sim tuteot ayawne.
Slä txo tuteo fmi 'ivampi ngat ro seng, fu nìfya'o, a 'eykefu ngati vä', tsakem ke lu sìltsan.
Tsaw lu ngeyä tokx! Kawtu ke tsun nìmuiä 'ivampi ngat txo ngal ke new tsakemit.
Ha kempe si nga? Nì'awve, nga plltxe san kehe. Tsakrr, ngal tsatsengti hum!

Offline Swoka Ikran

  • Palulukan Makto
  • *****
  • *
  • Posts: 1642
  • Karma: 29
Re: VrrtepCLI: Translator+
« Reply #38 on: May 23, 2011, 04:30:09 pm »
It works for me to just replace all instances of
os.path.expanduser('~')+"/.vrrtepcli/<filename>"
with
os.path.join(os.path.dirname(__file__), "<filename>")

I didn't use os.path.join/os.path.dirname...I just tried __FILE__+"/FILENAME". I'll give your method a shot. :)

Anyone know if Py2EXE will work with __FILE__? It doesn't with sys.path[0]...

EDIT: __FILE__ works in the .py version :) , but Py2EXE won't work with __FILE__. :( NameError: name '__FILE__' is not defined when I run the compiled EXE.
« Last Edit: May 23, 2011, 04:43:18 pm by Swoka Ikran »
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!

 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Offline Kä'eng

  • Uniltìranyu
  • **
  • Posts: 133
  • Karma: 12
Re: VrrtepCLI: Translator+
« Reply #39 on: May 23, 2011, 04:40:46 pm »
It has to be lower case: "__file__", not "__FILE__"

Another possibility is to use sys.argv[0], which should work even in py2exe. That's the path to the main script, not to the current module, but as long as they're all in the same directory it'll work fine.
« Last Edit: May 23, 2011, 04:47:18 pm by Kä'eng »
Ma evi, ke'u ke lu prrte' to fwa sim tuteot ayawne.
Slä txo tuteo fmi 'ivampi ngat ro seng, fu nìfya'o, a 'eykefu ngati vä', tsakem ke lu sìltsan.
Tsaw lu ngeyä tokx! Kawtu ke tsun nìmuiä 'ivampi ngat txo ngal ke new tsakemit.
Ha kempe si nga? Nì'awve, nga plltxe san kehe. Tsakrr, ngal tsatsengti hum!

 

Become LearnNavi's friend on Facebook Follow LearnNavi on Twitter! Watch LearnNavi's videos on YouTube

SMF 2.0.15 | SMF © 2017, Simple Machines
Privacy Policy
| XHTML | RSS | WAP2 | Site Rules

LearnNavi is not affiliated with the official Avatar website,
James Cameron, LightStorm Entertainment or The Walt Disney Company.
All trademarks and servicemarks are the properties of their respective owners.
Images in the LearnNavi.org Forums and Gallery may not be used without permission.

LearnNavi Affiliates:
ToS

LearnNavi is the community to learn Na'vi, the Avatar Language
"A place where real friendships are made." -Paul Frommer

AvatarMeet | Learn Na'vi Forum | Learn Na'vi Wiki | Na'viteri

LearnNavi