Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 8th January 2014, 19:18
mmtmalone mmtmalone is offline
Junior Member
 
Join Date: Nov 2011
Posts: 15
mmtmalone is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: Unix
Return value -2 on seq.open

I am trying to create a text file that I will eventually email to the user.
When I try to open the file, I get a -2 return value.
Can anyone tell me why????

I have verified that the path exists as I have another program that is using the same path and not having any trouble.
Here's my code:
temp.file = "app/data/installation/cust_avail_credit.txt"
seq.unlink(temp.file)
tfp = seq.open(temp.file,"wt+")
Reply With Quote
Sponsored Links
  #2  
Old 8th January 2014, 19:55
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,639
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
Ux Os ? - Enoent

Quote:
Originally Posted by mmtmalone View Post
I am trying to create a text file that I will eventually email to the user.
When I try to open the file, I get a -2 return value.
Can anyone tell me why????

I have verified that the path exists as I have another program that is using the same path and not having any trouble.
Here's my code:
temp.file = "app/data/installation/cust_avail_credit.txt"
seq.unlink(temp.file)
tfp = seq.open(temp.file,"wt+")
Hello,

string openmode The mode in which the file must be opened. This can be one of the following options:

"r" Open for reading. The current file position is placed at the start of the file.
"w" Open for writing. The file is created if it does not already exist. The current file position is placed at the start of the file.
"a" Open for writing. The file is created if it does not already exist. The current file position is placed at the end of the file.

The file position is placed at end of the file before every write statement, even if the previous file action was a seq.seek().

"x" Open for writing. This is the same as "w", except that the function fails if the file already exists.
"r+" Same as "r", but the file can also be written to.
"w+" Same as "w", but the file can also be read.
"a+" Same as "a", but the file can also be read.
"x+" Same as "x", but the file can also be read.
Use the following modes to indicate whether the file is a binary or a text file. You can combine one of these modes with any one of the previous modes (for example, "rt+").
"b" Use for binary files. This is the default mode and need not be specified.
"t" The line separator(s) for text-files are different on Windows NT and UNIX systems. CRLF on the former; LF only on the latter. In addition, a Windows NT text file can include an EOF-character (^Z) that indicates the end of the file. This character should not be returned to a program reading the file.

So, you must specify the "t" option when reading from or writing to a text file on Windows NT systems (for example, "at+".) This ensures that line separators and EOF characters are handled correctly. Never use the "t" option when opening a binary file; on Windows NT systems this will corrupt the file data. The "t" option has no effect on UNIX systems.

Normaly -2 says:

ENOENT
No such file or directory

This occurs when a specified file name should exist but does not, or when one of the directories in a path name does not exist.

2 ENOENT - No such file or directory
Description:
This error occurs when a specified file name should exist but does not, or when one of the directories in a path name does not exist.
Solution:
Possible solutions:
If a file or directory is missing, you must create the file or directory or restore them using a backup.
If a table is missing, check the company number. Your current company number can be different from the company number the Virtal Machine is using.
The file or directory exists, but still the error occurs. Check the redirection of the files.

Try to use FULL path :

temp.file = "app/data/installation/cust_avail_credit.txt"
temp.file = "/app/data/installation/cust_avail_credit.txt"

Regards
__________________
//Bernd

Last edited by bdittmar : 8th January 2014 at 19:57. Reason: FULL path
Reply With Quote
  #3  
Old 8th January 2014, 22:03
mmtmalone mmtmalone is offline
Junior Member
 
Join Date: Nov 2011
Posts: 15
mmtmalone is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: Unix
qualifying the entire directory did the trick
didn't realize that I missed that
Thanks!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undocumented Functions & Variables george7a Tools Development 81 30th September 2015 11:35
How to call AFS in sp24? PV Ramone AFS/DDC/OLE: Function servers 4 2nd September 2008 11:06
Compile error,help! gavin_wusj Tools Development 5 5th April 2005 09:09
API for the session timps4701m000 lli-baan AFS/DDC/OLE: Function servers 5 30th March 2005 15:50


All times are GMT +2. The time now is 00:59.


©2001-2017 - Baanboard.com - Baanforums.com